For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

possible discrepancy between backfill and live data with ccxt feeds.



  • I am running a live strategy with some ccxt feeds and it starts from 80 days ago. It works well for the backfeed data but something wrong happens when it switches to live feed. My strategy is based on daily candles and the older time point need for my indicators is 75 days old. Here is an example of the problem. These are the last lines from the output of the script I started yesterday (2018-02-27) :

    2018-02-25, 0 open trade(s): .
    2018-02-26, BUY LTC/BTC: size is 8.547585, value is 0.195110.
    2018-02-26, o:0.02282636, h:0.0239, l:0.021108, c:0.02122
    2018-02-26, previous highest close : 0.02276983, atr0.001654376805864954
    2018-02-26, prenext
    2018-02-26, 1 open trade(s): LTC/BTC.
    2018-02-26, prenext
    2018-02-26, 1 open trade(s): LTC/BTC.
    2018-02-27, BUY PURA/BTC: size is 1852.797522, value is 0.148205.
    2018-02-27, o:7.999e-05, h:8e-05, l:6.8e-05, c:6.82e-05
    2018-02-27, previous highest close : 7.999e-05, atr7.407824056208675e-06
    2018-02-27, OPERATION PROFIT for LTC/BTC, GROSS -0.03, NET -0.03, ACCOUNT VALUE 0.92622656
    2018-02-27, prenext
    2018-02-27, 1 open trade(s): PURA/BTC.
    2018-02-28, OPERATION PROFIT for PURA/BTC, GROSS -0.07, NET -0.07, ACCOUNT VALUE 0.90248296
    2018-02-28, BUY PURA/BTC: size is -3705.595045, value is -0.227894.
    2018-02-28, o:6.15e-05, h:6.15e-05, l:6.09e-05, c:6.09e-05
    2018-02-28, previous highest close : 7.999e-05, atr7.406283712548551e-06
    2018-02-28, prenext
    2018-02-28, 1 open trade(s): PURA/BTC.
    

    The 6 last lines appeared from live data last night.
    Now I have just started the same script again and as you can see below the lines for 2018-02-28 are different:

    2018-02-25, 0 open trade(s): .
    2018-02-26, BUY LTC/BTC: size is 8.745915, value is 0.199637.
    2018-02-26, o:0.02282636, h:0.0239, l:0.021108, c:0.02122
    2018-02-26, previous highest close : 0.02276983, atr0.0016177651269885407
    2018-02-26, prenext
    2018-02-26, 1 open trade(s): LTC/BTC.
    2018-02-26, prenext
    2018-02-26, 1 open trade(s): LTC/BTC.
    2018-02-27, BUY PURA/BTC: size is 1888.120251, value is 0.151031.
    2018-02-27, o:7.999e-05, h:8e-05, l:6.015e-05, c:6.15e-05
    2018-02-27, previous highest close : 7.999e-05, atr7.379766789472411e-06
    2018-02-27, OPERATION PROFIT for LTC/BTC, GROSS -0.03, NET -0.03, ACCOUNT VALUE 0.89939785
    2018-02-27, prenext
    2018-02-27, 1 open trade(s): PURA/BTC.
    2018-02-27, prenext
    2018-02-27, 1 open trade(s): PURA/BTC.
    2018-02-28, BUY OMG/BTC: size is 71.190246, value is 0.133098.
    2018-02-28, o:0.00186961, h:0.00195, l:0.00182406, c:0.00187304
    2018-02-28, previous highest close : 0.00186962, atr0.0001761445206513213
    2018-02-28, OPERATION PROFIT for PURA/BTC, GROSS -0.07, NET -0.07, ACCOUNT VALUE 0.89864013
    2018-02-28, prenext
    2018-02-28, 1 open trade(s): OMG/BTC.
    

    Actually the sell decision is the same in both situations (operation profit for pura/btc). However the buy decision is different. In the first case it makes no sense: buy a negative quantity of the same coin that was just sold.
    Note that prenext method is only calling next method.
    I am not too sure what could have gone wrong. I have had similar inconsistencies every time I have used this script so far. Has anyone any suggestion as of where to look first?
    @Ed-Bartosh : I have tagged you since my issue is maybe specifically related to the ccxt extension.



  • Not sure if it's related to ccxt, but I'm seeing similar issues: decisions are being made live that aren't made in backtesting. I'm going through the process of logging the live data to see what the issue is.



  • I wonder if it might be to do with the use of 'floats'. I noticed bittrex and ccxt are returning float values. Which I find a bit disturbing frankly, I don't want to do accountancy with floats.