bugfix
This commit is contained in:
Binary file not shown.
@ -39,7 +39,7 @@ class LiveInterface(GeneralInterface):
|
|||||||
|
|
||||||
return market_order.id
|
return market_order.id
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Nepodarilo se odeslat ", str(e))
|
print("Nepodarilo se odeslat buy", str(e))
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
"""buy limit"""
|
"""buy limit"""
|
||||||
@ -86,7 +86,7 @@ class LiveInterface(GeneralInterface):
|
|||||||
|
|
||||||
return market_order.id
|
return market_order.id
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Nepodarilo se odeslat ", str(e))
|
print("Nepodarilo se odeslat sell", str(e))
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
"""sell limit"""
|
"""sell limit"""
|
||||||
@ -111,7 +111,7 @@ class LiveInterface(GeneralInterface):
|
|||||||
return limit_order.id
|
return limit_order.id
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Nepodarilo se odeslat ", str(e))
|
print("Nepodarilo se odeslat sell_l", str(e))
|
||||||
#raise Exception(e)
|
#raise Exception(e)
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
|||||||
@ -34,18 +34,33 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#msgContainer {
|
#msgContainer {
|
||||||
display: grid;
|
display: inline-block;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
height: 568px;
|
height: 568px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msgContainerInner {
|
/* na male obrazovce je log pod grafem, zobrazujeme tedy prvni logy nahore */
|
||||||
display: flex;
|
@media (max-width : 1680px) {
|
||||||
overflow: auto;
|
.msgContainerInner {
|
||||||
height: 568px;
|
display: flex;
|
||||||
flex-direction: column-reverse;
|
overflow: auto;
|
||||||
|
height: 568px;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width : 1681px) {
|
||||||
|
.msgContainerInner {
|
||||||
|
display: flex;
|
||||||
|
overflow: auto;
|
||||||
|
height: 568px;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
display: block;
|
display: block;
|
||||||
/* padding: 9.5px; */
|
/* padding: 9.5px; */
|
||||||
|
|||||||
@ -36,6 +36,9 @@ class StrategyOrderLimitVykladaci(Strategy):
|
|||||||
self.state.avgp = float(data.price)
|
self.state.avgp = float(data.price)
|
||||||
price=price2dec(float(o.filled_avg_price)+self.state.vars.profit)
|
price=price2dec(float(o.filled_avg_price)+self.state.vars.profit)
|
||||||
self.state.vars.limitka = await self.interface.sell_l(price=price, size=o.filled_qty)
|
self.state.vars.limitka = await self.interface.sell_l(price=price, size=o.filled_qty)
|
||||||
|
#obcas live vrati "held for orders", odchytime chybu a limitku nevytvarime - spravi to dalsi notifikace nebo konzolidace
|
||||||
|
if self.state.vars.limitka == -1:
|
||||||
|
self.state.vars.limitka = None
|
||||||
self.state.vars.limitka_price = price
|
self.state.vars.limitka_price = price
|
||||||
self.state.ilog(e="Příchozí BUY notif - vytvarime limitku", msg="order status:"+o.status, orderid=str(o.id), limitka=str(self.state.vars.limitka), limtka_price=self.state.vars.limitka_price)
|
self.state.ilog(e="Příchozí BUY notif - vytvarime limitku", msg="order status:"+o.status, orderid=str(o.id), limitka=str(self.state.vars.limitka), limtka_price=self.state.vars.limitka_price)
|
||||||
else:
|
else:
|
||||||
@ -45,6 +48,9 @@ class StrategyOrderLimitVykladaci(Strategy):
|
|||||||
try:
|
try:
|
||||||
puvodni = self.state.vars.limitka
|
puvodni = self.state.vars.limitka
|
||||||
self.state.vars.limitka = await self.interface.repl(price=cena,orderid=self.state.vars.limitka,size=int(self.state.positions))
|
self.state.vars.limitka = await self.interface.repl(price=cena,orderid=self.state.vars.limitka,size=int(self.state.positions))
|
||||||
|
#odchyceni pripadne chyby na live
|
||||||
|
if self.state.vars.limitka == -1:
|
||||||
|
self.state.vars.limitka = puvodni
|
||||||
self.state.vars.limitka_price = cena
|
self.state.vars.limitka_price = cena
|
||||||
self.state.ilog(e="Příchozí BUY notif - menime limitku", msg="order status:"+o.status, orderid=str(o.id), limitka=str(self.state.vars.limitka), limtka_price=self.state.vars.limitka_price, puvodni_limitka=str(puvodni))
|
self.state.ilog(e="Příchozí BUY notif - menime limitku", msg="order status:"+o.status, orderid=str(o.id), limitka=str(self.state.vars.limitka), limtka_price=self.state.vars.limitka_price, puvodni_limitka=str(puvodni))
|
||||||
except APIError as e:
|
except APIError as e:
|
||||||
@ -60,11 +66,19 @@ class StrategyOrderLimitVykladaci(Strategy):
|
|||||||
if data.event == TradeEvent.PARTIAL_FILL:
|
if data.event == TradeEvent.PARTIAL_FILL:
|
||||||
self.state.ilog(e="SELL notifikace - Partial fill", msg="pouze update pozic", orderid=str(data.order.id))
|
self.state.ilog(e="SELL notifikace - Partial fill", msg="pouze update pozic", orderid=str(data.order.id))
|
||||||
ic("partial fill jen udpatujeme pozice")
|
ic("partial fill jen udpatujeme pozice")
|
||||||
|
#TODO tento update mozna vyhodit a pockat vzdy na plny fill - otestovat az bude cas
|
||||||
self.state.avgp, self.state.positions = self.interface.pos()
|
self.state.avgp, self.state.positions = self.interface.pos()
|
||||||
elif data.event == TradeEvent.FILL or data.event == TradeEvent.CANCELED:
|
elif data.event == TradeEvent.FILL or data.event == TradeEvent.CANCELED:
|
||||||
print("Příchozí SELL notifikace - complete FILL nebo CANCEL", data.event)
|
print("Příchozí SELL notifikace - complete FILL nebo CANCEL", data.event)
|
||||||
#muzeme znovu nakupovat, mazeme limitku, blockbuy a pendingbuys
|
#muzeme znovu nakupovat, mazeme limitku, blockbuy a pendingbuys
|
||||||
#self.state.blockbuy = 0
|
#self.state.blockbuy = 0
|
||||||
|
|
||||||
|
#ADDPROFIT - datd o funkce
|
||||||
|
prodej = data.order.filled_qty * data.order.filled_avg_price
|
||||||
|
nakup = self.state.positions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ic("notifikace sell mazeme limitku a update pozic")
|
ic("notifikace sell mazeme limitku a update pozic")
|
||||||
#updatujeme pozice
|
#updatujeme pozice
|
||||||
self.state.avgp, self.state.positions = self.interface.pos()
|
self.state.avgp, self.state.positions = self.interface.pos()
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -48,6 +48,7 @@ class Strategy:
|
|||||||
self.account = account
|
self.account = account
|
||||||
self.key = get_key(mode=self.mode, account=self.account)
|
self.key = get_key(mode=self.mode, account=self.account)
|
||||||
self.rtqueue = None
|
self.rtqueue = None
|
||||||
|
self.profit = 0
|
||||||
|
|
||||||
|
|
||||||
#TODO predelat na dynamické queues
|
#TODO predelat na dynamické queues
|
||||||
|
|||||||
Reference in New Issue
Block a user