intuition-io / intuition

Quantitative trading kit, for hackers
intuition.io
Apache License 2.0
123 stars 53 forks source link

Live FX algo testing #4

Closed avinashpandit closed 11 years ago

avinashpandit commented 11 years ago

For Live fx trading or backtesting with minutes data , zipline fails as the comparison is between different time frames.

(When i remove benchmark comparison assert ) With live data , algorithm is called for first tick and then system exits ? Is there any way to continuously call specified algorithm ?

Sample logs after for forex live backtest

root@avinash-vaio:/avinash/python-projects/ppQuanTrade/scripts# ./run_backtest.sh

C'est parti... [2013-03-22 02:13] Database - INFO: Reading NeuronQuant MySQL configuration... (192.168.249.202) [2013-03-22 02:13] Database - INFO: Reading NeuronQuant MySQL configuration... (192.168.249.202) [2013-03-22 02:13] ZMQ Messaging - INFO: Signal manager for handling code 2 (192.168.249.202) [2013-03-22 02:13] Engine - INFO: Configuration is Done. (192.168.249.202) [2013-03-22 02:13] Engine - INFO: -- Running backetester... Using algorithm: BuyAndHold (192.168.249.202) [2013-03-22 02:13] Engine - INFO: -- Using portfolio manager: Constant (192.168.249.202) [2013-03-22 02:13] Engine - INFO: [Debug] Algorithm BuyAndHold available, getting a reference to it. (192.168.249.202) [2013-03-22 02:13] Engine - INFO: [Debug] Manager Constant available, getting a reference and initializing it. (192.168.249.202) [2013-03-22 02:13] Database - INFO: Reading NeuronQuant MySQL configuration... (192.168.249.202) [2013-03-22 02:13] Database - INFO: Reading NeuronQuant MySQL configuration... (192.168.249.202) Benchmark on 2013-03-21 00:00:00+00:00: -0.00828249000776 [2013-03-22 02:13] Forex - DEBUG: [Fri, 22 Mar 2013 02:13:23 GMT] Authentification successful OK:200 (192.168.249.202) [2013-03-22 02:13] DataLiveSource - DEBUG: Waiting for Forex update (192.168.249.202) [2013-03-22 02:13] DataLiveSource - DEBUG: New income data, fire an event ! (192.168.249.202) [2013-03-22 02:13] DataLiveSource - DEBUG: Data available: Ask.Price 1.29127 Bid.Price 1.29122 High 1.28899 Low 1.29144 TimeStamp 1363918395849 Name: EUR/USD (192.168.249.202) [2013-03-22 02:13] DataLiveSource - DEBUG: Data available: Ask.Price 122.591 Bid.Price 122.576 High 122.373 Low 122.704 TimeStamp 1363918404545 Name: EUR/JPY (192.168.249.202)

[2013-03-22 02:13] Performance - INFO: Simulated 1 trading days out of 1. (192.168.249.202) [2013-03-22 02:13] Performance - INFO: first open: 2013-03-21 13:30:00+00:00 (192.168.249.202) [2013-03-22 02:13] Performance - INFO: last close: 2013-03-21 20:00:00+00:00 (192.168.249.202) [2013-03-22 02:13] Trade Labo - INFO: Portfolio returns: 100000.0 (192.168.249.202)

real 0m12.835s user 0m10.537s sys 0m0.532s root@avinash-vaio:/avinash/python-projects/ppQuanTrade/scripts#

I am eagerly waiting to try out various algorthms on live data. It would be nice if you fix live algo run on fx data .

xav-b commented 11 years ago

Although this is very experimental and more like a hack it should work since my last commit (both on master and develop branch I just merged). so I think this is a date issue. Indeed to make it live I just wrote a new data source and brought some little changes in zipline (like the comparison you removed), therefore it should behave as in backtest mode and loop until final date is reached. Zipline probably sees that it ran every trading days required and quit. I am trying to reproduce this behavior to see where it comes from.