GithubHelp home page GithubHelp logo

larytet / larytet-master Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 25.77 MB

Automatically exported from code.google.com/p/larytet-master

C# 58.17% JavaScript 1.51% CSS 3.23% Visual Basic 2.55% HTML 7.95% Java 4.43% Python 0.09% C++ 18.34% C 2.92% Objective-C 0.26% Shell 0.06% NSIS 0.51%

larytet-master's Introduction

larytet-master

Automatically exported from code.google.com/p/larytet-master

Automated quantitative trading framework targeting Tel Aviv Stock Exchange. High frequency data including order book for Maof 25 index options and Rezef securities is available. The framework provides market simulation and back testing facilities. The frameworks requires TaskBar? of FMR. Framework runs in Windows and Linux and written in C#.

מערכת מסחר אוטומטית מיעודת לבורסה של תל אביב. אופציות מעו"ף, מניות ושאר ני"ע הנחסרים ברצף. טאסקבר של פ.מ.ר. נתונים היסטוריים וסימולציה אסטרטגיות מסחר אוטומטיות

larytet-master's People

Contributors

larytet avatar

Watchers

 avatar

larytet-master's Issues

Exit without stopping data stream fails

What steps will reproduce the problem?
1. Oper,Login, Startlog mf
2. stoplog mf
3. exit - the app stays frozen, need to close the console window manually

Need to check if there are alive data streams. In the real TaskBar it is
perfectly OK and even desirable to exit the app without stopping the data
stream, because the stream stop is system-wide and it will affect all open
applications. The final cleanup can be done shutting down the TaskBar service.

TODO: add a warning informing the user that there is a data stream open,
preventing exit without stopping the stream. Add 'exit' command with a
parameter (e.g."exit !" - with an exclamation - like :q! in vi).

Original issue reported on code.google.com by [email protected] on 11 Oct 2009 at 1:25

USEFMRSIM in the FMRSim.VS.csproj

There is better way to switch between different sets of compilation flags.
It is possible to clone the existing project and compile two separate
projects - one for simulation and another for the real platform. 
VisualStudio provides convenient way to keep multiple projects under the
same umbrella. 
Two different projects, two different executables

Original issue reported on code.google.com by [email protected] on 19 Oct 2009 at 7:54

StatUtils::Length

The method can be replaced by lst.Count(). CSharp list keep number of
elements and returns the value via property field Count.

In the current implementation calculation of mean has complexity O(n^2)

Original issue reported on code.google.com by [email protected] on 19 Oct 2009 at 4:04

Broken date/time field


There is an issue with the data - the field
LST_DL_TM sometimes comes broken. This field is the time (minute-resolution)
when the last (latest) transaction took place. For instance, it may be
"00:21" instead of "10:21" OR " 6:12" instead of "16:12". I don't that it's
because of I/O processing by the application, but it comes already broken
from the FMR's server. Please take a look at the real data log samples,
attached (you can see the broken data in Rezef file).

Original issue reported on code.google.com by [email protected] on 13 Oct 2009 at 9:24

Market Simulation TODO

- More debug and testing is required

- MarketSimulation queues and books should be rewritten at some point to
make things simpler and more reliable. Too many "ifs" are in there

- GUI (probably no point if there is no real customer with cash)

- API in FMRShell to place orders - something similar to the API provided
by the MarketSimulation. This way trading core can employ the same API to
place/cancel orders. Support in the TaskbarLibSim for orders, probably via
MAOF MarketSimulation engine.

Original issue reported on code.google.com by [email protected] on 17 Jan 2010 at 8:59

Stopwatch and nano second timer resolution in the logs

In the Loggers Notify() clones the structure. We can add method
TimeStamp() to the relevant Loggers (or to the parent class) which
knows to add correct time stamp to any structure which contains two
fields - Ticks and Nanos (interface with two properties)
TimeStamp can be a static method
If we choose timestamp interface option we will do something like

FMRShell.MarketDataMaof

interface ITimeStamp
{
       int Ticks
       {
             get;
             protected set;
       }

       int Nanos
       {
             get;
             protected set;
       }
}

public struct MarketDataMaof : ICloneable, ITimeStamp
{
 ...
}

Sink (for example, logger) will log the time stamps in the log file or
process them in any appropriate way

Original issue reported on code.google.com by [email protected] on 10 Nov 2009 at 7:19

TaskBarLib API - Login activity is not available on certain times.

As it seems from tinkering with API, the COM object throws an exception 
(something about failed call to the object - I didn't copy the exact 
message, will do it next time). Probably it happens after trading, because 
the application closes automatically (around 8 PM). Adjusting computer's 
time solved the problem, and re-adjusting the time to the correct value 
didn't bring the exception back. Need to check more with the helpdesk.

Original issue reported on code.google.com by [email protected] on 29 Aug 2009 at 8:06

Stopwatch.IsHighResolution

Check Stopwatch.IsHighResolution field in the DateTimePrecise. When the
system provides high resolution tick probably no additional trickery is
required to get high precision real time time stamp.

Another possible workaround (for Windows at least) is to get a couple of
DateTime samples and check if the nanosecond part is not zero.

Original issue reported on code.google.com by [email protected] on 13 Jan 2010 at 1:06

last line in the log truncated

I execute oper/stoplog mf y in order to stop maof log. To the best of my
knowledge it closes the log file ? Then I execute oper/logout and then
exit. Still the last line of the log file gets truncated - not written fully.

Original issue reported on code.google.com by [email protected] on 30 Nov 2009 at 9:26

AARB todo list


  * Accumulate average price over the whole day instead of first X trades
  * Exit when profit exceeds 1.5% 
  * Sort the stocks by profit total and average per transaction. Find the milking cows.

Original issue reported on code.google.com by [email protected] on 2 Feb 2011 at 2:09

Data verification

A number of tests to do to validate the data:
1.
The changes of interest come in pairs (price, quantity).

Here is the list of such pairs:
       1- lmt_by1 , lmy_by1_nv
       2- lmt_by2 , lmy_by2_nv
       3- lmt_by3 , lmy_by3_nv
       4- lmt_sl1 , lmy_sl1_nv
       5- lmt_sl2 , lmy_sl2_nv
       6- lmt_sl3 , lmy_sl3_nv
       7- lst_dl_pr , lst_dl_vl

Check that either one of these pairs is updated in each record (no change
occurred in the other pairs). Multiple updates in the same record/event may
indicate a problem.

2.
Check that the last transaction data was retrieved correctly. This test can
be also an indication of a new transaction. Two steps:

       1- day_dil_no increments by 1. If greater increment was detected -
we have a problem.
       2- when there is increment in day_dil_no, check that delta(day_lv)
== lst_dl_vl.

I think that this is enough for the moment. I'll think about statistical
tests (what is "very different").

The ultimate solution to the problem will be to get the data simultaneously
from two or more separate sources. This will base the algo decision making
on more solid ground.



Original issue reported on code.google.com by [email protected] on 30 Nov 2009 at 10:36

MaofDataGeneratorLogFile is not recognized in non-simualted mode

MaofDataGeneratorLogFile (see SetupCommandLine_ms.cs) is not recognized in
non-simualted mode

MaofDataGeneratorLogFile is a part of TaskBarLibSim namespace - the code
won't compile if USEFMRSIM compilation flag is turned off, because it lacks
reference to TaskBarLibSim and uses FMR's TaskBarLib instead.

Moving the playback to a different namespace (maybe JQaunt?) may solve the
issue. Other suggestions?

Original issue reported on code.google.com by [email protected] on 22 Mar 2010 at 7:12

Data

There is a single number of observations per day with best bid = best ask.
Usually this data glitch is fixed within 100-500 ms. Need to think how to
filter this kind of data.

Original issue reported on code.google.com by [email protected] on 27 Oct 2009 at 10:28

Changes to do immediately

- Main Setup CLI - cleanup, divide by multiple files
- Two data collectors TA75, options back month  
- Check hooks in the market simulation and data generators (playback)
- 



Original issue reported on code.google.com by [email protected] on 21 Mar 2010 at 8:46

Restart log failes - StartLog fails after calling StopLog

To reproduce this issue:
1. Open the app, 'oper', 'login'
2. Startlog mf
3. Stoplog mf y
4. 'Startlog mf' produces the following error:

System.NullReferenceException: ההפניה לאובייקט לא הוגדרה 
למופע של אובייקט.
   ב-  JQuant.Program.OpenStreamAndLog(IWrite iWrite, Boolean test,
DataType dt,
 String filename, String loggerName) ב- C:\Documents and Settings\Aryeh\My
Docum
ents\SVN\JQuant\FMRSim\Main_SetupCommandLine.cs:שורה 257
   ב-  JQuant.Program.LogMaof(IWrite iWrite) ב- C:\Documents and
Settings\Aryeh\
My Documents\SVN\JQuant\FMRSim\Main_SetupCommandLine.cs:שורה 154
   ב-  JQuant.Program.operLogCallback(IWrite iWrite, String cmdName,
Object[] cm
dArguments) ב- C:\Documents and Settings\Aryeh\My
Documents\SVN\JQuant\FMRSim\Ma
in_SetupCommandLine.cs:שורה 130
   ב-  JQuant.CommandLineInterface.ProcessCommand(IWrite iWrite, String
cmdName)
 ב- C:\Documents and Settings\Aryeh\My
Documents\SVN\JQuant\CommadLineInterface.
cs:שורה 268
   ב-  JQuant.Program.Run() ב- C:\Documents and Settings\Aryeh\My
Documents\SVN\
JQuant\FMRSim\Main.cs:שורה 109

Original issue reported on code.google.com by [email protected] on 11 Oct 2009 at 12:20

Add strategy performance calculators

 * Net profit
 * Profit factor (gross profit/gross loss)
 * Profit to drawdown
 * Percent of profitable trades
 * Sharpe ratio
 * K-ratio (Lars Kestner)


Original issue reported on code.google.com by [email protected] on 7 Feb 2010 at 10:03

Exception on exit

Rarely the system causes exception when exiting 

Unhandled Exception: System.ArgumentOutOfRangeException: Value must be
positive and below the buffer height.
Parameter name: top
  at System.TermInfoDriver.SetCursorPosition (Int32 left, Int32 top) [0x00000] 
  at System.TermInfoDriver.WriteSpecialKey (ConsoleKeyInfo key) [0x00000] 
  at System.TermInfoDriver.Echo (ConsoleKeyInfo key) [0x00000] 
  at System.TermInfoDriver.ReadLine () [0x00000] 
  at System.ConsoleDriver.ReadLine () [0x00000] 
  at System.Console.ReadLine () [0x00000] 
  at JQuant.Program.Run () [0x00000] 
  at JQuant.Program.Main (System.String[] args) [0x00000] 

Original issue reported on code.google.com by [email protected] on 3 Jan 2010 at 5:08

Speech support

using System;
using System.Speech.Synthesis;
using System.Threading;

namespace TestNarrator
{
   class Program
   {
       static void Main(string[] args)
       {
           SpeechSynthesizer speaker = new SpeechSynthesizer();
           speaker.Rate = 1;
           speaker.Volume = 100;
           speaker.SelectVoice("Microsoft Mary");
           speaker.SpeakAsync("Welcome to the J. Quant. Trading system!");
           Thread.Sleep(1000);
           speaker.SelectVoice("Microsoft Sam");
           speaker.Speak("Call. Option. Has been. Sold!");
           Thread.Sleep(1000);
           speaker.SelectVoice("Microsoft Mike");
           speaker.Speak("Put. Option. Has been. Bought!");
       }
   }
}


Original issue reported on code.google.com by [email protected] on 13 Oct 2009 at 1:05

IB paper trading

_IB supportrs paper trading. I do not need to support paper trading option in 
the FSM like I did in all algos so far._

You probably do want to support paper trading too, in order to debug your algos 
code.

Original issue reported on code.google.com by [email protected] on 21 Apr 2011 at 9:25

TradingDataLogger

Class TradingDataLogger probably should be moved to FMRShell.cs. Do we need
the class at all ? May be just three classes 
 _maofDataLogger
 _rezefDataLogger
 _madadDataLogger

will  do ?
All three can share the same parent K3DataLogger which is an AsyncLogger.

Original issue reported on code.google.com by [email protected] on 11 Oct 2009 at 11:47

DateTime.Now and DateTime.UtcNow

Two methods have different performance according to
http://www.codeproject.com/KB/cs/DateTimePrecise.aspx?msg=2761979

Stopwatch.GetTimestamp()    0.000000184
DateTime.Now    0.000000226
DateTime.UtcNow     0.000000010
DateTime.UtcNow.ToLocalTime()   0.000000221
DateTimePrecise.Now     0.000000482
DateTimePrecise.UtcNow  0.000000248
DateTimePrecise.UtcNow.ToLocalTime()    0.000000455

226 micro for DateTime.Now and 10micro for DateTime.UtcNow
The difference between two is local time. Should be tested in Linux

Original issue reported on code.google.com by [email protected] on 4 Dec 2009 at 10:01

What is PELE customer ?

What is the difference between 
SendMaofOrder(), SendMaofOrderPele() and SendMaofSpeedOrderPele() ?

Original issue reported on code.google.com by [email protected] on 10 Aug 2009 at 1:04

TaskBarService termination

Need to shut down TaskBarService at the end of the session and/or restart
it anew at the beginning. If not the result will be unexpected termination
of TaskBarService with the following reason: "TaskBarService has passed
working hours and will be shut down." The termination of the service will
cause any logging / trading activity to stop and will require to re-login
in order to obtain new SessionId number.  

Original issue reported on code.google.com by [email protected] on 21 Oct 2009 at 8:32

Account manager TODO

The goal is to provide support for managing multiple trading accounts. In
the first phase account manager just collects all trades and allows the
application to get the list of the open positions and the cash balance. 
Following items are calculated
- Cash
- Short
- Margin


Cash accounts are typically not used in the option trading, so the cash
account most often is zero. The cash is stored in the margin account.

There are three groups - Balance, Holdings, Pending orders
In the "balance" table line margin shows free cash and in the "holdings"
table margin shows free cash+current market value of the holdings.

Table "Pending orders" shows the amount of cash (margin) locked by the
pending orders.

In the first phase we are not going to use leverage and thus "buying power"
is equal to the cash part of the margin minus pending orders.

Original issue reported on code.google.com by [email protected] on 22 Jan 2010 at 5:52

Compilation warnings

Performing main compilation...
/usr/bin/gmcs "/out:FMRSim/bin/Debug/FMRSim.exe" "/r:System.dll"
"/r:System.Xml.dll" "/r:System.Xml.Linq.dll" "/r:System.Windows.Forms.dll"
"/r:System.Web.dll" "/r:System.Drawing.dll" "/r:System.Design.dll"
"/r:System.Drawing.Design.dll" "/r:System.Data.dll"
"/r:System.Configuration.dll" "/r:System.Configuration.Install.dll"
"/r:System.Data.DataSetExtensions.dll" "/r:System.Data.Linq.dll"
"/r:System.Management.dll" "/r:System.Runtime.Remoting.dll"
"/r:System.Core.dll" /noconfig /nologo /warn:3 /debug:+ /debug:full
/optimize- /codepage:utf8
/define:"DEBUG;USEFMRSIM;NOTFMRSHELLMAIN;WITHGUI_" /main:JQuant.Program
/t:exe "FMRSim/Main.cs" "FMRSim/AssemblyInfo.cs" "CommadLineInterface.cs"
"Mailbox.cs" "Resources.cs" "MailboxThread.cs" "Pool.cs" "Utils.cs"
"IProducer.cs" "Logger.cs" "FMRSim/TaskBarLibSim.cs" "FMR/FMRShell.cs"
"Forms.cs" "FMRSim/Main_SetupCommandLine.cs" "Timers.cs"
"FMRSim/TaskBarLibSim_Orders.cs" "ThreadPool.cs" "Order.cs" "TA.cs"
"Feed.cs" "Security.cs" "AlgorithmMachine.cs" "CyclicBuffer.cs" 
Compilation succeeded - 9 warning(s)

CyclicBuffer.cs(147,24): warning CS0108: `JQuant.IntStatistics.Add(object)'
hides inherited member `JQuant.CyclicBuffer.Add(object)'. Use the new
keyword if hiding was intended
CyclicBuffer.cs(23,21): (Location of the symbol related to previous warning)
CyclicBuffer.cs(152,26): warning CS0108: `JQuant.IntStatistics.Remove()'
hides inherited member `JQuant.CyclicBuffer.Remove()'. Use the new keyword
if hiding was intended
CyclicBuffer.cs(38,23): (Location of the symbol related to previous warning)
FMRSim/Main_SetupCommandLine.cs(985,23): warning CS0219: The variable
`orderType' is assigned but its value is never used
Utils.cs(272,29): warning CS0219: The variable `x' is assigned but its
value is never used
FMR/FMRShell.cs(1296,17): warning CS0219: The variable `ret' is assigned
but its value is never used
Feed.cs(92,20): warning CS0219: The variable `readStream' is assigned but
its value is never used
FMR/FMRShell.cs(1840,14): warning CS0169: The private method
`FMRShell.MaofOrderFSM.InitOrder_IDLE()' is never used
AlgorithmMachine.cs(110,22): warning CS0169: The private field
`JQuant.Algorithm.MFOrderFSM' is never used
AlgorithmMachine.cs(115,27): warning CS0414: The private field
`JQuant.Algorithm.MFOrdProducer' is assigned but its value is never used

Original issue reported on code.google.com by [email protected] on 15 Oct 2009 at 3:48

Redundand code when building log filename

I would add a public static method which returns the paths, for example,

string Resources.GetLogsFolder()

and method which builds filename for all logs in the system
Resources.CreateLogFilename(string name, LogType type)
{
   string filename = Resources.GetLogsFolder() +  DateNowToFilename();
   switch (type)
  {
    case CSV: filename += ".csv";
  }
 return filename;
}

In the LoLogMaof call will look like

string filename = CreateLogFilename("MaofLog_",  LogType.CSV);

This way all filenames are generated in the same place and unified.

Original issue reported on code.google.com by [email protected] on 13 Oct 2009 at 7:56

what exactly does mean שידור חוזר/תיקון ?

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 11 Aug 2009 at 2:53

Parallel loggin and trading

The goal is to run algorithm across two or more trading computers connected
to the network

Restrictions
- Only one computer executes trades at any give point (active or trading
station).
- Standby machine discovers that the trading computer is down in less than
500ms.
- Standby machines decide on the next active (trading) based on the strict
preset priority.


Some design related ideas
- Active station announces the trade by sending a packet (e-mail ? phone
call modem to modem) to one of the standby computers. An external HTTPS
server can be used for posting trades. 

- Sending a packet requires two Internet connections or two computers
connected to two Internet connections. One connection is used for VPN and
can not be used for general Internet browsing. There are more than one way
to solve the problem. In a simple approach a regular phone lines can be
used for connectivity between the stations. 

Original issue reported on code.google.com by [email protected] on 10 Nov 2009 at 1:10

GUI: MAOF options watch list

Two screens: watch list and placed orders

1. Watch list

Total 6 columns: Order Strike Price Strike Price Order
The table has two sides - puts and calls. In the order column put star if
there is a pending order for the option. 

2. Pending orders

Total 12 columns: Strike, Price, Quantity, Strike, Price, Quantity
The table has two sides puts and calls and two groups on each side - buy
and sell.

Original issue reported on code.google.com by [email protected] on 19 Jan 2010 at 11:45

US Data feed

TickData, Reuters, Bloomberg
Capital IQ.
CQG 
FMXConnect.com
E-signal

Original issue reported on code.google.com by [email protected] on 14 Nov 2009 at 8:41

Line is up/idle indication

For example, application can produce a short beep (by printing ASCII symbol
7) every 3-5s if there was an activity in any of the data streams over that
period. 
The state machine is fairly simple:
A mailbox thread which gets a notification from the data collectors every
time there is a new event. Thread counts the events. Thread starts timer
and when timer expires beeps if the counter is non-zero. Thread zero the
counter when timer expires.

Original issue reported on code.google.com by [email protected] on 14 Oct 2009 at 12:12

Pending order number

Beside polling of the method GetOrdersMF() is there any way to get
asynchronous notification when the order status is changed.


Original issue reported on code.google.com by [email protected] on 10 Aug 2009 at 1:06

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.