Skip to content

Commit

Permalink
raw
Browse files Browse the repository at this point in the history
  • Loading branch information
Lu-Yi-Hsun committed Nov 3, 2019
1 parent 6f17d9f commit 230b298
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions iqoptionapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class IQOptionAPI(object): # pylint: disable=too-many-instance-attributes
underlying_list_data = None
position_changed = None
instrument_quites_generated_data = nested_dict(2, dict)
instrument_quotes_generated_raw_data=nested_dict(2, dict)
instrument_quites_generated_timestamp = nested_dict(2, dict)
strike_list = None
position_changed_data = {}
Expand Down
5 changes: 5 additions & 0 deletions iqoptionapi/stable_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,11 @@ def unsubscribe_strike_list(self, ACTIVE,expiration_period):
del self.api.instrument_quites_generated_data[ACTIVE]
self.api.unsubscribe_instrument_quites_generated(ACTIVE,expiration_period)

def get_instrument_quites_generated_data(self,ACTIVE,duration):
while self.api.instrument_quotes_generated_raw_data[ACTIVE][duration*60]=={}:
pass
return self.api.instrument_quotes_generated_raw_data[ACTIVE][duration*60]

def get_realtime_strike_list(self, ACTIVE, duration):
while True:
if not self.api.instrument_quites_generated_data[ACTIVE][duration*60]:
Expand Down
3 changes: 3 additions & 0 deletions iqoptionapi/ws/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def on_message(self, message): # pylint: disable=unused-argument
elif message["name"]=="result":
self.api.result=message["msg"]["success"]
elif message["name"]=="instrument-quotes-generated":

Active_name=list(OP_code.ACTIVES.keys())[list(OP_code.ACTIVES.values()).index(message["msg"]["active"])]
period=message["msg"]["expiration"]["period"]
ans={}
Expand Down Expand Up @@ -235,6 +236,8 @@ def on_message(self, message): # pylint: disable=unused-argument
pass
self.api.instrument_quites_generated_timestamp[Active_name][period]=message["msg"]["expiration"]["timestamp"]
self.api.instrument_quites_generated_data[Active_name][period]=ans

self.api.instrument_quotes_generated_raw_data[Active_name][period]=message
elif message["name"]=="training-balance-reset":
self.api.training_balance_reset_request=message["msg"]["isSuccessful"]

Expand Down

0 comments on commit 230b298

Please sign in to comment.