Skip to content

Commit

Permalink
fix order modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
traderpedroso committed Mar 29, 2023
1 parent e3a6be9 commit f4e55d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions ejtraderCT/api/ctrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,15 @@ def position_list_callback(self, data: dict, price_data: dict, client_id: str):
self.client.update(positions = positions)
logging.debug("client_id %s positions: %s", client_id, positions)

def getPositionIdByOriginId(self, posId: str):
def getPositionIdByOriginId(self, posId: str, client_id: str):
if posId in self.fix.origin_to_pos_id:
return self.fix.position_list[self.fix.origin_to_pos_id[posId]]

def getOrdersIdByOriginId(self, ordId: str, client_id: str):
return self.fix.origin_to_ord_id[ordId]
if ordId in self.fix.origin_to_ord_id: # Verifique se a chave existe antes de acessá-la
return self.fix.origin_to_ord_id[ordId]
else:
return None # Retorne None ou outro valor padrão quando a chave não existir

def cancelOrdersByOriginId(self, clIdArr, client_id: str):
if clIdArr == None:
Expand Down
1 change: 1 addition & 0 deletions ejtraderCT/api/fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ def get_origin_from_pos_id(self, pos_id):
return None

def process_position_list(self, msg):

if msg[Field.PosReqResult] == "2":
return
name = self.sec_id_table[int(msg[Field.Symbol])]["name"]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def requirements(filename):

setup(
name='ejtraderCT',
version='1.0.6',
version='1.0.7',
packages=find_packages(),
url='https://ejtraderCT.readthedocs.io/',
download_url='https://ejtrader.com',
Expand Down

0 comments on commit f4e55d0

Please sign in to comment.