atreyuxtrading / atreyu-backtrader-api

Atreyu's integration of IB Native API with backtrader
BSD 2-Clause "Simplified" License
93 stars 62 forks source link

Adding more than one data (=Symbol) doesn't work for me #1

Open Suikabon opened 2 years ago

Suikabon commented 2 years ago

Hey Atreyu trading,

Great library, thanks for integrating with original TWS API. Very clean code. However, there still seems to be a glitch with threading. Running the sample from the readme that has more than one symbol doesn't work for me. If first data is GOOG, then it retrieves a batch with Google historical data, as I can see with debug set to True, but then hangs and never gets the response for the AAPL request. If change the order in the code, then I get the AAPL data, but no GOOG data.

Thanks Reinke

Below is the output in debug mode from your example (I ran it with AMZN instead of AAPL, but result is the same): Calling connectAck() Calling managedAccounts('DUXXXXXX') Calling reqCurrentTime() Calling nextValidId(1) Calling error(-1, 2104, 'Market data farm connection is OK:hfarm') Calling error(-1, 2104, 'Market data farm connection is OK:eufarmnj') Calling error(-1, 2104, 'Market data farm connection is OK:cashfarm') Calling error(-1, 2104, 'Market data farm connection is OK:usfuture') Calling error(-1, 2104, 'Market data farm connection is OK:jfarm') Calling error(-1, 2104, 'Market data farm connection is OK:usfarm.nj') Calling error(-1, 2104, 'Market data farm connection is OK:eufarm') Calling error(-1, 2104, 'Market data farm connection is OK:usfarm') Calling error(-1, 2106, 'HMDS data farm connection is OK:euhmds') Calling error(-1, 2106, 'HMDS data farm connection is OK:ushmds.nj') Calling error(-1, 2106, 'HMDS data farm connection is OK:cashhmds') Calling error(-1, 2106, 'HMDS data farm connection is OK:fundfarm') Calling error(-1, 2106, 'HMDS data farm connection is OK:ushmds') Calling error(-1, 2158, 'Sec-def data farm connection is OK:secdefnj') Calling currentTime(1663164990) Calling contractDetails(16777216, 140192311566224: 3691937,AMZN,STK,,0.0,,,SMART,NASDAQ,USD,AMZN,NMS,False,,combo:,NMS,0.01,ACTIVETIM,AD,ADJUST,ALERT,ALGO,ALLOC,AON,AVGCOST,BASKET,BENCHPX,CASHQTY,COND,CONDORDER,DARKONLY,DARKPOLL,DAY,DEACT,DEACTDIS,DEACTEOD,DIS,DUR,GAT,GTC,GTD,GTT,HID,IBKRATS,ICE,IMB,IOC,LIT,LMT,LOC,MIDPX,MIT,MKT,MOC,MTL,NGCOMB,NODARK,NONALGO,OCA,OPG,OPGREROUT,PEGBENCH,PEGMID,POSTATS,POSTONLY,PREOPGRTH,PRICECHK,REL,REL2MID,RELPCTOFS,RPI,RTH,SCALE,SCALEODD,SCALERST,SIZECHK,SMARTSTG,SNAPMID,SNAPMKT,SNAPREL,STP,STPLMT,SWEEP,TRAIL,TRAILLIT,TRAILLMT,TRAILMIT,WHATIF,SMART,AMEX,NYSE,CBOE,PHLX,ISE,CHX,ARCA,ISLAND,DRCTEDGE,BEX,BATS,EDGEA,CSFBALGO,JEFFALGO,BYX,IEX,EDGX,FOXRIVER,PEARL,NYSENAT,LTSE,MEMX,TPLUS1,PSX,1,0,AMAZON.COM INC,,Communications,Internet,E-Commerce/Products,US/Eastern,20220914:0400-20220914:2000;20220915:0400-20220915:2000;20220916:0400-20220916:2000;20220917:CLOSED;20220918:CLOSED;20220919:0400-20220919:2000,20220914:0930-20220914:1600;20220915:0930-20220915:1600;20220916:0930-20220916:1600;20220917:CLOSED;20220918:CLOSED;20220919:0930-20220919:1600,,0,100,,,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,1,[140192311564448: ISIN=US0231351067;],,COMMON,,,,,,False,False,0,False,,,,,False,) Calling contractDetailsEnd(16777216) Calling reqHistoricalDataEx(contract=140192311564496: 3691937,AMZN,STK,,0.0,,,SMART,NASDAQ,USD,AMZN,NMS,False,,combo:, enddate=datetime.datetime(2018, 5, 1, 0, 0), begindate=datetime.datetime(2018, 1, 1, 0, 0), timeframe=5, compression=1, what='TRADES', useRTH=False, tz=None, sessionend=datetime.time(23, 59, 59, 999990)) Calling historicalData(16777217, 140192311562864: Date: 20180102, Open: 58.390000, High: 59.500000, Low: 58.390000, Close: 59.300000, Volume: 362006, Average: 59.214400, BarCount: 10587) Calling historicalData(16777217, 140192310323872: Date: 20180103, Open: 59.440000, High: 60.270000, Low: 59.330000, Close: 60.150000, Volume: 428208, Average: 59.995700, BarCount: 13522) Calling historicalData(16777217, 140192310323440: Date: 20180104, Open: 60.400000, High: 60.790000, Low: 60.230000, Close: 60.510000, Volume: 415628, Average: 60.504250, BarCount: 12929) Calling historicalData(16777217, 140192310324208: Date: 20180105, Open: 60.550000, High: 61.560000, Low: 60.500000, Close: 61.530000, Volume: 482647, Average: 61.088200, BarCount: 14759) Calling historicalData(16777217, 140192310324064: Date: 20180108, Open: 61.670000, High: 62.650000, Low: 61.500000, Close: 62.360000, Volume: 558346, Average: 62.216000, BarCount: 17556) Calling historicalData(16777217, 140192310323488: Date: 20180109, Open: 62.410000, High: 62.970000, Low: 62.090000, Close: 62.640000, Volume: 520424, Average: 62.540200, BarCount: 15995) Calling historicalData(16777217, 140192310324784: Date: 20180110, Open: 62.500000, High: 62.800000, Low: 61.860000, Close: 62.800000, Volume: 379151, Average: 62.417450, BarCount: 11669) Calling historicalData(16777217, 140192310324352: Date: 20180111, Open: 62.850000, High: 63.900000, Low: 62.820000, Close: 63.890000, Volume: 446149, Average: 63.307650, BarCount: 14075) Calling historicalData(16777217, 140192310324640: Date: 20180112, Open: 64.100000, High: 65.350000, Low: 63.630000, Close: 65.350000, Volume: 774483, Average: 64.858800, BarCount: 24457) Calling historicalData(16777217, 140192310324448: Date: 20180116, Open: 65.780000, High: 67.000000, Low: 64.610000, Close: 64.950000, Volume: 1031908, Average: 65.927700, BarCount: 32467) Calling historicalData(16777217, 140192310318496: Date: 20180117, Open: 65.500000, High: 65.810000, Low: 64.040000, Close: 64.940000, Volume: 752364, Average: 64.770750, BarCount: 22903) Calling historicalData(16777217, 140192310324928: Date: 20180118, Open: 64.800000, High: 65.230000, Low: 64.200000, Close: 64.700000, Volume: 564736, Average: 64.755350, BarCount: 17042) Calling historicalData(16777217, 140192310325072: Date: 20180119, Open: 64.890000, High: 65.950000, Low: 64.650000, Close: 64.720000, Volume: 658129, Average: 65.014000, BarCount: 18755) Calling historicalData(16777217, 140192310325216: Date: 20180122, Open: 64.800000, High: 66.870000, Low: 64.730000, Close: 66.740000, Volume: 566553, Average: 65.753050, BarCount: 16272) Calling historicalData(16777217, 140192310325360: Date: 20180123, Open: 66.950000, High: 68.290000, Low: 66.560000, Close: 68.060000, Volume: 671661, Average: 67.580900, BarCount: 20338) Calling historicalData(16777217, 140192310325504: Date: 20180124, Open: 68.250000, High: 69.410000, Low: 66.900000, Close: 67.980000, Volume: 959970, Average: 68.117150, BarCount: 29466) Calling historicalData(16777217, 140192310325648: Date: 20180125, Open: 68.330000, High: 68.920000, Low: 67.880000, Close: 68.900000, Volume: 665466, Average: 68.507900, BarCount: 20322) Calling historicalData(16777217, 140192310325792: Date: 20180126, Open: 69.100000, High: 70.340000, Low: 69.040000, Close: 70.320000, Volume: 669755, Average: 69.817500, BarCount: 19615) Calling historicalData(16777217, 140192310325936: Date: 20180129, Open: 70.400000, High: 71.570000, Low: 70.020000, Close: 70.950000, Volume: 762968, Average: 70.828200, BarCount: 23325) Calling historicalData(16777217, 140192310326080: Date: 20180130, Open: 70.580000, High: 71.960000, Low: 69.600000, Close: 71.900000, Volume: 777056, Average: 71.013050, BarCount: 24213) Calling historicalData(16777217, 140192310326224: Date: 20180131, Open: 72.400000, High: 73.630000, Low: 72.200000, Close: 73.150000, Volume: 872497, Average: 72.975200, BarCount: 25801) Calling historicalData(16777217, 140192310326368: Date: 20180201, Open: 73.420000, High: 74.250000, Low: 69.000000, Close: 73.860000, Volume: 1149704, Average: 71.438850, BarCount: 36877) Calling historicalData(16777217, 140192310326512: Date: 20180202, Open: 73.590000, High: 74.900000, Low: 70.700000, Close: 71.350000, Volume: 1516359, Average: 72.896650, BarCount: 50362) Calling historicalData(16777217, 140192310326752: Date: 20180205, Open: 71.050000, High: 72.950000, Low: 66.040000, Close: 68.750000, Volume: 1509764, Average: 70.963950, BarCount: 47544) Calling historicalData(16777217, 140192310327040: Date: 20180206, Open: 68.700000, High: 72.240000, Low: 67.500000, Close: 72.150000, Volume: 1434275, Average: 70.328850, BarCount: 46821) Calling historicalData(16777217, 140192310326848: Date: 20180207, Open: 71.770000, High: 73.050000, Low: 70.450000, Close: 70.650000, Volume: 927001, Average: 72.113550, BarCount: 29203) Calling historicalData(16777217, 140192310326656: Date: 20180208, Open: 71.160000, High: 71.820000, Low: 67.090000, Close: 67.600000, Volume: 1063411, Average: 69.301600, BarCount: 34831) Calling historicalData(16777217, 140192310327232: Date: 20180209, Open: 67.750000, High: 69.170000, Low: 63.300000, Close: 67.110000, Volume: 1817615, Average: 66.171950, BarCount: 61785) Calling historicalData(16777217, 140192310327376: Date: 20180212, Open: 67.550000, High: 69.690000, Low: 67.200000, Close: 69.350000, Volume: 829939, Average: 68.645400, BarCount: 25870) Calling historicalData(16777217, 140192310327520: Date: 20180213, Open: 69.240000, High: 70.990000, Low: 68.750000, Close: 70.800000, Volume: 779296, Average: 70.395150, BarCount: 24080) Calling historicalData(16777217, 140192310327664: Date: 20180214, Open: 71.100000, High: 72.600000, Low: 70.000000, Close: 72.580000, Volume: 772207, Average: 71.706200, BarCount: 24053) Calling historicalData(16777217, 140192310327808: Date: 20180215, Open: 73.350000, High: 73.450000, Low: 71.840000, Close: 73.140000, Volume: 752165, Average: 72.935800, BarCount: 23814) Calling historicalData(16777217, 140192310328288: Date: 20180216, Open: 73.500000, High: 73.550000, Low: 72.330000, Close: 72.340000, Volume: 608836, Average: 72.767300, BarCount: 16914) Calling historicalData(16777217, 140192310328144: Date: 20180220, Open: 72.010000, High: 74.440000, Low: 71.500000, Close: 73.630000, Volume: 890691, Average: 73.426600, BarCount: 25738) Calling historicalData(16777217, 140192310327904: Date: 20180221, Open: 73.600000, High: 75.170000, Low: 73.450000, Close: 73.850000, Volume: 834251, Average: 74.559450, BarCount: 26049) Calling historicalData(16777217, 140192310328384: Date: 20180222, Open: 73.860000, High: 75.130000, Low: 73.790000, Close: 74.460000, Volume: 643798, Average: 74.447750, BarCount: 20040) Calling historicalData(16777217, 140192310328528: Date: 20180223, Open: 74.750000, High: 75.030000, Low: 74.330000, Close: 75.020000, Volume: 596366, Average: 74.745450, BarCount: 17679) Calling historicalData(16777217, 140192310328672: Date: 20180226, Open: 75.250000, High: 76.250000, Low: 75.250000, Close: 76.240000, Volume: 682149, Average: 75.852900, BarCount: 19996) Calling historicalData(16777217, 140192310328816: Date: 20180227, Open: 76.450000, High: 76.450000, Low: 75.360000, Close: 75.800000, Volume: 636656, Average: 75.899650, BarCount: 18741) Calling historicalData(16777217, 140192310328960: Date: 20180228, Open: 76.000000, High: 76.440000, Low: 75.600000, Close: 75.800000, Volume: 574773, Average: 75.969950, BarCount: 15816) Calling historicalData(16777217, 140192310329104: Date: 20180301, Open: 76.540000, High: 76.540000, Low: 73.250000, Close: 74.780000, Volume: 881505, Average: 74.710100, BarCount: 28275) Calling historicalData(16777217, 140192310329248: Date: 20180302, Open: 74.310000, High: 75.150000, Low: 72.750000, Close: 75.140000, Volume: 931552, Average: 74.039400, BarCount: 28693) Calling historicalData(16777217, 140192310317632: Date: 20180305, Open: 75.180000, High: 76.270000, Low: 74.050000, Close: 76.200000, Volume: 712181, Average: 75.457050, BarCount: 21367) Calling historicalData(16777217, 140192310317488: Date: 20180306, Open: 76.350000, High: 77.110000, Low: 75.600000, Close: 75.650000, Volume: 617349, Average: 76.778100, BarCount: 18280) Calling historicalData(16777217, 140192310317344: Date: 20180307, Open: 75.990000, High: 77.300000, Low: 75.900000, Close: 77.200000, Volume: 553375, Average: 76.845050, BarCount: 15820) Calling historicalData(16777217, 140192310317200: Date: 20180308, Open: 77.250000, High: 77.740000, Low: 77.250000, Close: 77.600000, Volume: 484936, Average: 77.542200, BarCount: 14072) Calling historicalData(16777217, 140192310317056: Date: 20180309, Open: 77.700000, High: 78.950000, Low: 77.630000, Close: 78.930000, Volume: 617069, Average: 78.462000, BarCount: 18324) Calling historicalData(16777217, 140192310316912: Date: 20180312, Open: 79.500000, High: 80.270000, Low: 79.110000, Close: 80.000000, Volume: 723762, Average: 79.894750, BarCount: 20471) Calling historicalData(16777217, 140192310316768: Date: 20180313, Open: 80.000000, High: 80.900000, Low: 78.900000, Close: 79.210000, Volume: 867711, Average: 79.798800, BarCount: 27325) Calling historicalData(16777217, 140192310316624: Date: 20180314, Open: 80.000000, High: 80.320000, Low: 79.540000, Close: 79.740000, Volume: 566616, Average: 79.879600, BarCount: 18074) Calling historicalData(16777217, 140192310316480: Date: 20180315, Open: 79.900000, High: 80.000000, Low: 78.910000, Close: 79.350000, Volume: 546749, Average: 79.202000, BarCount: 18714) Calling historicalData(16777217, 140192310316336: Date: 20180316, Open: 79.250000, High: 79.500000, Low: 78.380000, Close: 78.580000, Volume: 726484, Average: 78.789950, BarCount: 18210) Calling historicalData(16777217, 140192310316192: Date: 20180319, Open: 77.420000, High: 78.750000, Low: 76.270000, Close: 77.000000, Volume: 827655, Average: 77.130500, BarCount: 28198) Calling historicalData(16777217, 140192310316048: Date: 20180320, Open: 77.460000, High: 79.550000, Low: 77.250000, Close: 79.530000, Volume: 595279, Average: 78.469950, BarCount: 18875) Calling historicalData(16777217, 140192310315904: Date: 20180321, Open: 79.400000, High: 79.530000, Low: 78.160000, Close: 79.000000, Volume: 650365, Average: 78.998300, BarCount: 19522) Calling historicalData(16777217, 140192310315760: Date: 20180322, Open: 78.640000, High: 78.700000, Low: 75.910000, Close: 76.350000, Volume: 778647, Average: 77.753700, BarCount: 24433) Calling historicalData(16777217, 140192310315616: Date: 20180323, Open: 76.430000, High: 77.450000, Low: 74.690000, Close: 74.750000, Volume: 1005688, Average: 75.934250, BarCount: 31117) Calling historicalData(16777217, 140192310315472: Date: 20180326, Open: 75.550000, High: 78.000000, Low: 74.960000, Close: 78.000000, Volume: 724545, Average: 76.628750, BarCount: 21907) Calling historicalData(16777217, 140192310315328: Date: 20180327, Open: 78.650000, High: 78.800000, Low: 74.120000, Close: 75.500000, Volume: 871486, Average: 76.945250, BarCount: 26807) Calling historicalData(16777217, 140192310315184: Date: 20180328, Open: 74.200000, High: 75.500000, Low: 69.310000, Close: 71.350000, Volume: 1734968, Average: 71.314800, BarCount: 57774) Calling historicalData(16777217, 140192310315040: Date: 20180329, Open: 71.390000, High: 72.770000, Low: 68.260000, Close: 72.300000, Volume: 1691011, Average: 70.868850, BarCount: 52600) Calling historicalData(16777217, 140192310314896: Date: 20180402, Open: 71.810000, High: 71.810000, Low: 67.750000, Close: 68.250000, Volume: 1295412, Average: 69.065650, BarCount: 41786) Calling historicalData(16777217, 140192310314752: Date: 20180403, Open: 68.650000, High: 70.700000, Low: 67.770000, Close: 69.250000, Volume: 1347075, Average: 69.182950, BarCount: 44297) Calling historicalData(16777217, 140192310314608: Date: 20180404, Open: 68.100000, High: 70.940000, Low: 67.310000, Close: 70.900000, Volume: 916870, Average: 69.239700, BarCount: 28747) Calling historicalData(16777217, 140192310314464: Date: 20180405, Open: 71.550000, High: 72.980000, Low: 70.650000, Close: 71.000000, Volume: 833907, Average: 72.251950, BarCount: 27169) Calling historicalData(16777217, 140192310314320: Date: 20180406, Open: 71.580000, High: 72.630000, Low: 70.010000, Close: 70.250000, Volume: 768701, Average: 71.229150, BarCount: 24097) Calling historicalData(16777217, 140192310314176: Date: 20180409, Open: 71.040000, High: 71.920000, Low: 70.050000, Close: 70.250000, Volume: 544898, Average: 71.179050, BarCount: 16984) Calling historicalData(16777217, 140192310314032: Date: 20180410, Open: 71.250000, High: 71.920000, Low: 70.790000, Close: 71.760000, Volume: 544186, Average: 71.422200, BarCount: 16328) Calling historicalData(16777217, 140192310313888: Date: 20180411, Open: 71.600000, High: 72.440000, Low: 71.080000, Close: 71.670000, Volume: 463640, Average: 71.835600, BarCount: 13292) Calling historicalData(16777217, 140192310313744: Date: 20180412, Open: 71.440000, High: 72.610000, Low: 71.440000, Close: 72.280000, Volume: 415622, Average: 72.328750, BarCount: 12676) Calling historicalData(16777217, 140192310313600: Date: 20180413, Open: 72.010000, High: 72.990000, Low: 71.230000, Close: 71.650000, Volume: 488615, Average: 72.079900, BarCount: 14075) Calling historicalData(16777217, 140192310313456: Date: 20180416, Open: 71.700000, High: 72.500000, Low: 71.370000, Close: 72.450000, Volume: 355231, Average: 71.941000, BarCount: 11875) Calling historicalData(16777217, 140192310313312: Date: 20180417, Open: 72.550000, High: 75.460000, Low: 72.550000, Close: 75.400000, Volume: 675998, Average: 74.309250, BarCount: 21354) Calling historicalData(16777217, 140192310313168: Date: 20180418, Open: 75.550000, High: 77.900000, Low: 75.210000, Close: 77.700000, Volume: 677134, Average: 76.139750, BarCount: 21940) Calling historicalData(16777217, 140192310313072: Date: 20180419, Open: 77.990000, High: 78.430000, Low: 76.950000, Close: 78.070000, Volume: 814515, Average: 77.721150, BarCount: 26674) Calling historicalData(16777217, 140192310322000: Date: 20180420, Open: 77.500000, High: 78.290000, Low: 75.800000, Close: 76.630000, Volume: 711019, Average: 76.950400, BarCount: 22029) Calling historicalData(16777217, 140192310322144: Date: 20180423, Open: 76.600000, High: 77.400000, Low: 75.170000, Close: 76.150000, Volume: 592521, Average: 76.323850, BarCount: 17659) Calling historicalData(16777217, 140192310322288: Date: 20180424, Open: 76.450000, High: 76.980000, Low: 72.420000, Close: 73.280000, Volume: 1004716, Average: 73.822900, BarCount: 32606) Calling historicalData(16777217, 140192310322432: Date: 20180425, Open: 73.130000, High: 74.400000, Low: 70.750000, Close: 74.320000, Volume: 877031, Average: 72.399000, BarCount: 28898) Calling historicalData(16777217, 140192310322576: Date: 20180426, Open: 74.250000, High: 82.050000, Low: 73.920000, Close: 80.900000, Volume: 1023704, Average: 76.403850, BarCount: 33547) Calling historicalData(16777217, 140192310322720: Date: 20180427, Open: 80.360000, High: 83.240000, Low: 78.300000, Close: 78.400000, Volume: 1617421, Average: 79.796450, BarCount: 53245) Calling historicalData(16777217, 140192310421360: Date: 20180430, Open: 79.250000, High: 79.800000, Low: 78.050000, Close: 78.580000, Volume: 691444, Average: 78.816600, BarCount: 20803) Calling historicalDataEnd(16777217, '20180101 08:00:00', '20180501 08:00:00') Calling contractDetails(16777218, 140192311564688: 208813720,GOOG,STK,,0.0,,,SMART,NASDAQ,USD,GOOG,NMS,False,,combo:,NMS,0.01,ACTIVETIM,AD,ADJUST,ALERT,ALGO,ALLOC,AON,AVGCOST,BASKET,BENCHPX,CASHQTY,COND,CONDORDER,DARKONLY,DARKPOLL,DAY,DEACT,DEACTDIS,DEACTEOD,DIS,DUR,GAT,GTC,GTD,GTT,HID,IBKRATS,ICE,IMB,IOC,LIT,LMT,LOC,MIDPX,MIT,MKT,MOC,MTL,NGCOMB,NODARK,NONALGO,OCA,OPG,OPGREROUT,PEGBENCH,PEGMID,POSTATS,POSTONLY,PREOPGRTH,PRICECHK,REL,REL2MID,RELPCTOFS,RPI,RTH,SCALE,SCALEODD,SCALERST,SIZECHK,SMARTSTG,SNAPMID,SNAPMKT,SNAPREL,STP,STPLMT,SWEEP,TRAIL,TRAILLIT,TRAILLMT,TRAILMIT,WHATIF,SMART,AMEX,NYSE,CBOE,PHLX,ISE,CHX,ARCA,ISLAND,DRCTEDGE,BEX,BATS,EDGEA,CSFBALGO,JEFFALGO,BYX,IEX,EDGX,FOXRIVER,PEARL,NYSENAT,LTSE,MEMX,TPLUS1,PSX,1,0,ALPHABET INC-CL C,,Communications,Internet,Web Portals/ISP,US/Eastern,20220914:0400-20220914:2000;20220915:0400-20220915:2000;20220916:0400-20220916:2000;20220917:CLOSED;20220918:CLOSED;20220919:0400-20220919:2000,20220914:0930-20220914:1600;20220915:0930-20220915:1600;20220916:0930-20220916:1600;20220917:CLOSED;20220918:CLOSED;20220919:0930-20220919:1600,,0,100,,,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,1,[140192311564592: ISIN=US02079K1079;],,COMMON,,,,,,False,False,0,False,,,,,False,) Calling contractDetailsEnd(16777218) Calling reqHistoricalDataEx(contract=140192311564640: 208813720,GOOG,STK,,0.0,,,SMART,NASDAQ,USD,GOOG,NMS,False,,combo:, enddate=datetime.datetime(2018, 5, 1, 0, 0), begindate=datetime.datetime(2018, 1, 1, 0, 0), timeframe=5, compression=1, what='TRADES', useRTH=False, tz=None, sessionend=datetime.time(23, 59, 59, 999990)) Calling connectionClosed() Final Portfolio Value: 100000.00