LeaveMyYard / BitmexGridTrader

The grid strategy bot for trading on bitmex with the PyQt5 User Interface
MIT License
35 stars 21 forks source link

Position issues #4

Open dannycoin opened 3 years ago

dannycoin commented 3 years ago

2021-03-31 06:21:01,909 - MarketMaker - _on_user_update - DEBUG - Order 7e78dc3b-d4ee-472c-b847-e60312ac0748 (57661.5;1000): FILLED 2021-03-31 06:21:01,909 - MarketMaker - _on_userupdate - INFO - Balance: nan, Position: 57820.1082660994, 2000 2021-03-31 06:21:01,913 - MarketMaker - _on_user_update - WARNING - Position, got from server differes with the calculated one: (57836.8999; 2000) vs (57820.1082660994; 2000)_ File "/home/danny/DEV/Python/bots/BitmexGridTrader-master/crypto_futures_py/bitmex.py", line 316, in start_user_update_socket process_msg(result) File "/home/danny/DEV/Python/bots/BitmexGridTrader-master/crypto_futures_py/bitmex.py", line 299, in __process_msg process_position_update(msg) File "/home/danny/DEV/Python/bots/BitmexGridTrader-master/crypto_futures_py/bitmex.py", line 255, in __process_position_update onupdate( File "/home/danny/DEV/Python/bots/BitmexGridTrader-master/sourse/marketmaker.py", line 173, in _on_user_update self.position.price = data.price An error happened in user update socket AttributeError 'PositionUpdate' object has no attribute 'price':_ {"table":"position","action":"update","data":[{"account":180969,"symbol":"XBTUSD","openOrderBuyQty":3000,"openOrderBuyCost":-5257000,"execBuyQty":1000,"execBuyCost":1734000,"execQty":1000,"execCost":-1734000,"execComm":-433,"currentTimestamp":"2021-03-31T10:21:00.790Z","currentQty":2000,"currentCost":-3543000,"currentComm":883,"unrealisedCost":-3459000,"grossOpenCost":5257000,"grossExecCost":1734000,"markValue":-3478000,"riskValue":8735000,"homeNotional":0.03478,"foreignNotional":-2000,"posCost":-3459000,"posCost2":-3459000,"posInit":691800,"posComm":3114,"posMargin":694914,"posMaint":15567,"initMargin":1060075,"maintMargin":675914,"realisedPnl":83117,"unrealisedGrossPnl":-19000,"unrealisedPnl":-19000,"unrealisedPnlPcnt":-0.0055,"unrealisedRoePcnt":-0.0275,"avgCostPrice":57836.8999,"avgEntryPrice":57836.8999,"breakEvenPrice":57837,"marginCallPrice":48333,"liquidationPrice":48333,"bankruptPrice":48193,"timestamp":"2021-03-31T10:21:00.790Z","lastValue":-3478000,"currency":"XBt","markPrice":57503.37}]}, restarting...