Open mattia177 opened 5 years ago
Nothing my friend? Il giorno mer 10 lug 2019 alle ore 17:50 ardemagni mattia < ardemagni.mattia@gmail.com> ha scritto: … Thank you, really appreciate it! Il giorno mer 10 lug 2019 alle 15:45 Anson @.***> ha scritto: > I think it is very easy , I will add it > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <#65?email_source=notifications&email_token=AKGLQ5EPFA4XJUKFNEUCHWTP6XRWFA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZTQEPY#issuecomment-510067263>, > or mute the thread > https://github.com/notifications/unsubscribe-auth/AKGLQ5DUWG4F32IQJH5PV7DP6XRWFANCNFSM4GMBMHCA > . >
this code can buy the price near current price!
from iqoptionapi.stable_api import IQ_Option import time import random I_want_money=IQ_Option("email","pasword") goal="EURUSD" size=1#size=[1,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,28800,43200,86400,604800,2592000,"all"] maxdict=1 print("start stream...") I_want_money.start_candles_stream(goal,size,maxdict) print("print candles") candle=I_want_money.get_realtime_candles(goal,size) key=list(candle)[0] current_price=candle[key]["close"] print("current_price",current_price) ###### duration=1#minute 1 or 5 amount=1 buy="call"#or "put" I_want_money.subscribe_strike_list(goal) #get strike_list data=I_want_money.get_realtime_strike_list(goal, duration) #get price list price_list=list(data.keys()) close_current_price=[] for p_list in price_list: close_current_price.append(abs(current_price-float(p_list))) most_close_price=price_list[close_current_price.index(min(close_current_price))] print("most_close_price",most_close_price,"current_price",current_price) print(data[str(most_close_price)]) #random choose Strategy choose_price=most_close_price #get instrument_id instrument_id=data[choose_price][buy]["id"] #get profit profit=data[choose_price][buy]["profit"] print("choose you want to buy") print("price:",choose_price,"side:call","instrument_id:",instrument_id,"profit:",profit) #put instrument_id to buy buy_check,id=I_want_money.buy_digital(amount,instrument_id) if buy_check: print("wait for check win") #check win while True: check_close,win_money=I_want_money.check_win_digital(id) if check_close: if float(win_money)>0: win_money=("%.2f" % (win_money)) print("you win",win_money,"money") else: print("you loose") break I_want_money.unsubscribe_strike_list(buy) else: print("fail to buy,please run again,digit is change very fast so sometime if can not buy the price!,please try more time")
After the API update yesterday, after 1 hour of execution I am getting this error bellow:
2019-08-13 11:07:21,607 {"request_id":"","name":"position","msg":{"position":{"last_change_reason":"market_order","instrument_id_escape":"doUSDCHF201908131410PT5MP097274","instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":735301131,"user_id":49006564,"user_balance_id":234839765,"user_balance_type":4,"create_at":1565705102354,"update_at":1565705102354,"close_at":null,"type":"long","leverage":1,"count":0.380512,"count_realized":0.0,"status":"open","buy_amount":19.99998,"sell_amount":0.0,"buy_amount_enrolled":19.99998,"sell_amount_enrolled":0.0,"commission_amount":0.0,"commission":0.0,"commission_enrolled":0.0,"close_effect_amount":null,"close_effect_amount_enrolled":null,"close_reason":null,"close_underlying_price":null,"open_underlying_price":0.97276,"pnl_realized":0.0,"pnl_realized_enrolled":0.0,"buy_avg_price":52.560707,"buy_avg_price_enrolled":52.560707,"sell_avg_price":0.0,"sell_avg_price_enrolled":0.0,"stop_lose_order_id":null,"take_profit_order_id":null,"tpsl_extra":null,"currency":"USD","margin":0.0,"margin_call":0.0,"margin_call_enrolled":0.0,"swap":0.0,"swap_enrolled":0.0,"custodial":0.0,"custodial_enrolled":0.0,"custodial_last_age":0,"user_group_id":184,"charge":0.0,"charge_enrolled":0.0,"orders":[],"currency_unit":1,"currency_rate":1.0,"open_client_platform_id":9,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"last_change_reason":"market_order","use_token_for_commission":false},"order_ids":[1335930181],"last_index":7124327955},"orders":[{"instrument_id_escape":"doUSDCHF201908131410PT5MP097274","basic_stoplimit_amount":20.0,"take_profit_price":null,"stop_lose_price":null,"tpsl_extra":null,"instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":1335930181,"user_id":49006564,"user_balance_id":234839765,"user_group_id":184,"user_balance_type":4,"position_id":735301131,"create_at":1565705102038,"update_at":1565705102206,"execute_at":1565705102354,"side":"buy","type":"market","status":"filled","execute_status":"trade","count":0.380512,"leverage":1,"underlying_price":0.97276,"avg_price":52.560707,"avg_price_enrolled":52.560707,"client_platform_id":9,"limit_price":0.0,"stop_price":null,"currency":"USD","margin":19.99998,"spread":null,"commission_amount":0.0,"commission_amount_enrolled":0.0,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"paid_for_commission":0,"use_token_for_commission":false,"paid_for_commission_enrolled":0},"time_in_force":"good_till_cancel","time_in_force_date":null,"last_index":3655230481}]},"status":2000}
2019-08-13 11:07:21,614 {"name": "sendMessage", "msg": {"name": "get-order", "body": {"order_id": 1335930181}}, "request_id": ""}
2019-08-13 11:07:21,827 {"request_id":"","name":"order","msg":{"instrument_id_escape":"doUSDCHF201908131410PT5MP097274","basic_stoplimit_amount":20.0,"take_profit_price":null,"stop_lose_price":null,"tpsl_extra":null,"instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":1335930181,"user_id":49006564,"user_balance_id":234839765,"user_group_id":184,"user_balance_type":4,"position_id":735301131,"create_at":1565705102038,"update_at":1565705102206,"execute_at":1565705102354,"side":"buy","type":"market","status":"filled","execute_status":"trade","count":0.380512,"leverage":1,"underlying_price":0.97276,"avg_price":52.560707,"avg_price_enrolled":52.560707,"client_platform_id":9,"limit_price":0.0,"stop_price":null,"currency":"USD","margin":19.99998,"spread":null,"commission_amount":0.0,"commission_amount_enrolled":0.0,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"paid_for_commission":0,"use_token_for_commission":false,"paid_for_commission_enrolled":0},"time_in_force":"good_till_cancel","time_in_force_date":null,"last_index":3655230481},"status":2000}
2019-08-13 11:07:21,827 {"name": "sendMessage", "msg": {"name": "get-position", "body": {"position_id": 735301131}}, "request_id": ""}
2019-08-13 11:07:22,032 {"request_id":"","name":"position","msg":{"position":{"last_change_reason":"market_order","instrument_id_escape":"doUSDCHF201908131410PT5MP097274","instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":735301131,"user_id":49006564,"user_balance_id":234839765,"user_balance_type":4,"create_at":1565705102354,"update_at":1565705102354,"close_at":null,"type":"long","leverage":1,"count":0.380512,"count_realized":0.0,"status":"open","buy_amount":19.99998,"sell_amount":0.0,"buy_amount_enrolled":19.99998,"sell_amount_enrolled":0.0,"commission_amount":0.0,"commission":0.0,"commission_enrolled":0.0,"close_effect_amount":null,"close_effect_amount_enrolled":null,"close_reason":null,"close_underlying_price":null,"open_underlying_price":0.97276,"pnl_realized":0.0,"pnl_realized_enrolled":0.0,"buy_avg_price":52.560707,"buy_avg_price_enrolled":52.560707,"sell_avg_price":0.0,"sell_avg_price_enrolled":0.0,"stop_lose_order_id":null,"take_profit_order_id":null,"tpsl_extra":null,"currency":"USD","margin":0.0,"margin_call":0.0,"margin_call_enrolled":0.0,"swap":0.0,"swap_enrolled":0.0,"custodial":0.0,"custodial_enrolled":0.0,"custodial_last_age":0,"user_group_id":184,"charge":0.0,"charge_enrolled":0.0,"orders":[],"currency_unit":1,"currency_rate":1.0,"open_client_platform_id":9,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"last_change_reason":"market_order","use_token_for_commission":false},"order_ids":[1335930181],"last_index":7124327955},"orders":[{"instrument_id_escape":"doUSDCHF201908131410PT5MP097274","basic_stoplimit_amount":20.0,"take_profit_price":null,"stop_lose_price":null,"tpsl_extra":null,"instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":1335930181,"user_id":49006564,"user_balance_id":234839765,"user_group_id":184,"user_balance_type":4,"position_id":735301131,"create_at":1565705102038,"update_at":1565705102206,"execute_at":1565705102354,"side":"buy","type":"market","status":"filled","execute_status":"trade","count":0.380512,"leverage":1,"underlying_price":0.97276,"avg_price":52.560707,"avg_price_enrolled":52.560707,"client_platform_id":9,"limit_price":0.0,"stop_price":null,"currency":"USD","margin":19.99998,"spread":null,"commission_amount":0.0,"commission_amount_enrolled":0.0,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"paid_for_commission":0,"use_token_for_commission":false,"paid_for_commission_enrolled":0},"time_in_force":"good_till_cancel","time_in_force_date":null,"last_index":3655230481}]},"status":2000}
2019-08-13 11:07:22,032 {"name": "sendMessage", "msg": {"name": "get-order", "body": {"order_id": 1335930181}}, "request_id": ""}
2019-08-13 11:07:22,248 {"request_id":"","name":"order","msg":{"instrument_id_escape":"doUSDCHF201908131410PT5MP097274","basic_stoplimit_amount":20.0,"take_profit_price":null,"stop_lose_price":null,"tpsl_extra":null,"instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":1335930181,"user_id":49006564,"user_balance_id":234839765,"user_group_id":184,"user_balance_type":4,"position_id":735301131,"create_at":1565705102038,"update_at":1565705102206,"execute_at":1565705102354,"side":"buy","type":"market","status":"filled","execute_status":"trade","count":0.380512,"leverage":1,"underlying_price":0.97276,"avg_price":52.560707,"avg_price_enrolled":52.560707,"client_platform_id":9,"limit_price":0.0,"stop_price":null,"currency":"USD","margin":19.99998,"spread":null,"commission_amount":0.0,"commission_amount_enrolled":0.0,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"paid_for_commission":0,"use_token_for_commission":false,"paid_for_commission_enrolled":0},"time_in_force":"good_till_cancel","time_in_force_date":null,"last_index":3655230481},"status":2000}
2019-08-13 11:07:22,254 {"name": "sendMessage", "msg": {"name": "get-position", "body": {"position_id": 735301131}}, "request_id": ""}
2019-08-13 11:07:22,254 {"name":"timeSync","msg":1565705242119}
2019-08-13 11:07:22,254 {"name":"heartbeat","msg":1565705242119}
2019-08-13 11:07:22,255 {"name": "heartbeat", "msg": {"msg": {"heartbeatTime": 1565705242119, "userTime": 1565705242119}}, "request_id": ""}
Traceback (most recent call last):
File "/Users/valderi/Documents/iqoptionapi/test_com_soros.py", line 326, in <module>
id)
File "/Users/valderi/Documents/iqoptionapi/iqoptionapi/stable_api.py", line 714, in check_win_digital
check, data = self.get_position(buy_order_id)
File "/Users/valderi/Documents/iqoptionapi/iqoptionapi/stable_api.py", line 845, in get_position
self.api.get_position(position_id)
File "/Users/valderi/Documents/iqoptionapi/iqoptionapi/ws/chanels/get_positions.py", line 26, in __call__
self.send_websocket_request(self.name, data)
File "/Users/valderi/Documents/iqoptionapi/iqoptionapi/ws/chanels/base.py", line 23, in send_websocket_request
return self.api.send_websocket_request(name, msg,request_id)
File "/Users/valderi/Documents/iqoptionapi/iqoptionapi/api.py", line 243, in send_websocket_request
self.websocket.send(data)
File "/usr/local/lib/python3.7/site-packages/websocket/_app.py", line 147, in send
if not self.sock or self.sock.send(data, opcode) == 0:
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 240, in send
return self.send_frame(frame)
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 265, in send_frame
l = self._send(data)
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 430, in _send
return send(self.sock, data)
File "/usr/local/lib/python3.7/site-packages/websocket/_socket.py", line 117, in send
return sock.send(data)
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 984, in send
return self._sslobj.write(data)
OSError: [Errno 22] Invalid argument
PS: before the code update I could run for a lot of hours in a row without get any error.
Nothing my friend? Il giorno mer 10 lug 2019 alle ore 17:50 ardemagni mattia < ardemagni.mattia@gmail.com> ha scritto: … Thank you, really appreciate it! Il giorno mer 10 lug 2019 alle 15:45 Anson @.***> ha scritto: > I think it is very easy , I will add it > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <#65?email_source=notifications&email_token=AKGLQ5EPFA4XJUKFNEUCHWTP6XRWFA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZTQEPY#issuecomment-510067263>, > or mute the thread > https://github.com/notifications/unsubscribe-auth/AKGLQ5DUWG4F32IQJH5PV7DP6XRWFANCNFSM4GMBMHCA > . >
this code can buy the price near current price!
from iqoptionapi.stable_api import IQ_Option import time import random I_want_money=IQ_Option("email","pasword") goal="EURUSD" size=1#size=[1,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,28800,43200,86400,604800,2592000,"all"] maxdict=1 print("start stream...") I_want_money.start_candles_stream(goal,size,maxdict) print("print candles") candle=I_want_money.get_realtime_candles(goal,size) key=list(candle)[0] current_price=candle[key]["close"] print("current_price",current_price) ###### duration=1#minute 1 or 5 amount=1 buy="call"#or "put" I_want_money.subscribe_strike_list(goal) #get strike_list data=I_want_money.get_realtime_strike_list(goal, duration) #get price list price_list=list(data.keys()) close_current_price=[] for p_list in price_list: close_current_price.append(abs(current_price-float(p_list))) most_close_price=price_list[close_current_price.index(min(close_current_price))] print("most_close_price",most_close_price,"current_price",current_price) print(data[str(most_close_price)]) #random choose Strategy choose_price=most_close_price #get instrument_id instrument_id=data[choose_price][buy]["id"] #get profit profit=data[choose_price][buy]["profit"] print("choose you want to buy") print("price:",choose_price,"side:call","instrument_id:",instrument_id,"profit:",profit) #put instrument_id to buy buy_check,id=I_want_money.buy_digital(amount,instrument_id) if buy_check: print("wait for check win") #check win while True: check_close,win_money=I_want_money.check_win_digital(id) if check_close: if float(win_money)>0: win_money=("%.2f" % (win_money)) print("you win",win_money,"money") else: print("you loose") break I_want_money.unsubscribe_strike_list(buy) else: print("fail to buy,please run again,digit is change very fast so sometime if can not buy the price!,please try more time")
After the API update yesterday, after 1 hour of execution I am getting this error bellow:
2019-08-13 11:07:21,607 {"request_id":"","name":"position","msg":{"position":{"last_change_reason":"market_order","instrument_id_escape":"doUSDCHF201908131410PT5MP097274","instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":735301131,"user_id":49006564,"user_balance_id":234839765,"user_balance_type":4,"create_at":1565705102354,"update_at":1565705102354,"close_at":null,"type":"long","leverage":1,"count":0.380512,"count_realized":0.0,"status":"open","buy_amount":19.99998,"sell_amount":0.0,"buy_amount_enrolled":19.99998,"sell_amount_enrolled":0.0,"commission_amount":0.0,"commission":0.0,"commission_enrolled":0.0,"close_effect_amount":null,"close_effect_amount_enrolled":null,"close_reason":null,"close_underlying_price":null,"open_underlying_price":0.97276,"pnl_realized":0.0,"pnl_realized_enrolled":0.0,"buy_avg_price":52.560707,"buy_avg_price_enrolled":52.560707,"sell_avg_price":0.0,"sell_avg_price_enrolled":0.0,"stop_lose_order_id":null,"take_profit_order_id":null,"tpsl_extra":null,"currency":"USD","margin":0.0,"margin_call":0.0,"margin_call_enrolled":0.0,"swap":0.0,"swap_enrolled":0.0,"custodial":0.0,"custodial_enrolled":0.0,"custodial_last_age":0,"user_group_id":184,"charge":0.0,"charge_enrolled":0.0,"orders":[],"currency_unit":1,"currency_rate":1.0,"open_client_platform_id":9,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"last_change_reason":"market_order","use_token_for_commission":false},"order_ids":[1335930181],"last_index":7124327955},"orders":[{"instrument_id_escape":"doUSDCHF201908131410PT5MP097274","basic_stoplimit_amount":20.0,"take_profit_price":null,"stop_lose_price":null,"tpsl_extra":null,"instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":1335930181,"user_id":49006564,"user_balance_id":234839765,"user_group_id":184,"user_balance_type":4,"position_id":735301131,"create_at":1565705102038,"update_at":1565705102206,"execute_at":1565705102354,"side":"buy","type":"market","status":"filled","execute_status":"trade","count":0.380512,"leverage":1,"underlying_price":0.97276,"avg_price":52.560707,"avg_price_enrolled":52.560707,"client_platform_id":9,"limit_price":0.0,"stop_price":null,"currency":"USD","margin":19.99998,"spread":null,"commission_amount":0.0,"commission_amount_enrolled":0.0,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"paid_for_commission":0,"use_token_for_commission":false,"paid_for_commission_enrolled":0},"time_in_force":"good_till_cancel","time_in_force_date":null,"last_index":3655230481}]},"status":2000} 2019-08-13 11:07:21,614 {"name": "sendMessage", "msg": {"name": "get-order", "body": {"order_id": 1335930181}}, "request_id": ""} 2019-08-13 11:07:21,827 {"request_id":"","name":"order","msg":{"instrument_id_escape":"doUSDCHF201908131410PT5MP097274","basic_stoplimit_amount":20.0,"take_profit_price":null,"stop_lose_price":null,"tpsl_extra":null,"instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":1335930181,"user_id":49006564,"user_balance_id":234839765,"user_group_id":184,"user_balance_type":4,"position_id":735301131,"create_at":1565705102038,"update_at":1565705102206,"execute_at":1565705102354,"side":"buy","type":"market","status":"filled","execute_status":"trade","count":0.380512,"leverage":1,"underlying_price":0.97276,"avg_price":52.560707,"avg_price_enrolled":52.560707,"client_platform_id":9,"limit_price":0.0,"stop_price":null,"currency":"USD","margin":19.99998,"spread":null,"commission_amount":0.0,"commission_amount_enrolled":0.0,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"paid_for_commission":0,"use_token_for_commission":false,"paid_for_commission_enrolled":0},"time_in_force":"good_till_cancel","time_in_force_date":null,"last_index":3655230481},"status":2000} 2019-08-13 11:07:21,827 {"name": "sendMessage", "msg": {"name": "get-position", "body": {"position_id": 735301131}}, "request_id": ""} 2019-08-13 11:07:22,032 {"request_id":"","name":"position","msg":{"position":{"last_change_reason":"market_order","instrument_id_escape":"doUSDCHF201908131410PT5MP097274","instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":735301131,"user_id":49006564,"user_balance_id":234839765,"user_balance_type":4,"create_at":1565705102354,"update_at":1565705102354,"close_at":null,"type":"long","leverage":1,"count":0.380512,"count_realized":0.0,"status":"open","buy_amount":19.99998,"sell_amount":0.0,"buy_amount_enrolled":19.99998,"sell_amount_enrolled":0.0,"commission_amount":0.0,"commission":0.0,"commission_enrolled":0.0,"close_effect_amount":null,"close_effect_amount_enrolled":null,"close_reason":null,"close_underlying_price":null,"open_underlying_price":0.97276,"pnl_realized":0.0,"pnl_realized_enrolled":0.0,"buy_avg_price":52.560707,"buy_avg_price_enrolled":52.560707,"sell_avg_price":0.0,"sell_avg_price_enrolled":0.0,"stop_lose_order_id":null,"take_profit_order_id":null,"tpsl_extra":null,"currency":"USD","margin":0.0,"margin_call":0.0,"margin_call_enrolled":0.0,"swap":0.0,"swap_enrolled":0.0,"custodial":0.0,"custodial_enrolled":0.0,"custodial_last_age":0,"user_group_id":184,"charge":0.0,"charge_enrolled":0.0,"orders":[],"currency_unit":1,"currency_rate":1.0,"open_client_platform_id":9,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"last_change_reason":"market_order","use_token_for_commission":false},"order_ids":[1335930181],"last_index":7124327955},"orders":[{"instrument_id_escape":"doUSDCHF201908131410PT5MP097274","basic_stoplimit_amount":20.0,"take_profit_price":null,"stop_lose_price":null,"tpsl_extra":null,"instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":1335930181,"user_id":49006564,"user_balance_id":234839765,"user_group_id":184,"user_balance_type":4,"position_id":735301131,"create_at":1565705102038,"update_at":1565705102206,"execute_at":1565705102354,"side":"buy","type":"market","status":"filled","execute_status":"trade","count":0.380512,"leverage":1,"underlying_price":0.97276,"avg_price":52.560707,"avg_price_enrolled":52.560707,"client_platform_id":9,"limit_price":0.0,"stop_price":null,"currency":"USD","margin":19.99998,"spread":null,"commission_amount":0.0,"commission_amount_enrolled":0.0,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"paid_for_commission":0,"use_token_for_commission":false,"paid_for_commission_enrolled":0},"time_in_force":"good_till_cancel","time_in_force_date":null,"last_index":3655230481}]},"status":2000} 2019-08-13 11:07:22,032 {"name": "sendMessage", "msg": {"name": "get-order", "body": {"order_id": 1335930181}}, "request_id": ""} 2019-08-13 11:07:22,248 {"request_id":"","name":"order","msg":{"instrument_id_escape":"doUSDCHF201908131410PT5MP097274","basic_stoplimit_amount":20.0,"take_profit_price":null,"stop_lose_price":null,"tpsl_extra":null,"instrument_strike_value":972740,"instrument_type":"digital-option","instrument_id":"doUSDCHF201908131410PT5MP097274","instrument_underlying":"USDCHF","instrument_active_id":72,"instrument_expiration":1565705400000,"instrument_strike":0.97274,"instrument_dir":"put","instrument_period":300,"instrument_percent":null,"id":1335930181,"user_id":49006564,"user_balance_id":234839765,"user_group_id":184,"user_balance_type":4,"position_id":735301131,"create_at":1565705102038,"update_at":1565705102206,"execute_at":1565705102354,"side":"buy","type":"market","status":"filled","execute_status":"trade","count":0.380512,"leverage":1,"underlying_price":0.97276,"avg_price":52.560707,"avg_price_enrolled":52.560707,"client_platform_id":9,"limit_price":0.0,"stop_price":null,"currency":"USD","margin":19.99998,"spread":null,"commission_amount":0.0,"commission_amount_enrolled":0.0,"extra_data":{"amount":20000000,"version":"4.0","init_time":1565705102019,"use_trail_stop":false,"auto_margin_call":false,"paid_for_commission":0,"use_token_for_commission":false,"paid_for_commission_enrolled":0},"time_in_force":"good_till_cancel","time_in_force_date":null,"last_index":3655230481},"status":2000} 2019-08-13 11:07:22,254 {"name": "sendMessage", "msg": {"name": "get-position", "body": {"position_id": 735301131}}, "request_id": ""} 2019-08-13 11:07:22,254 {"name":"timeSync","msg":1565705242119} 2019-08-13 11:07:22,254 {"name":"heartbeat","msg":1565705242119} 2019-08-13 11:07:22,255 {"name": "heartbeat", "msg": {"msg": {"heartbeatTime": 1565705242119, "userTime": 1565705242119}}, "request_id": ""} Traceback (most recent call last): File "/Users/valderi/Documents/iqoptionapi/test_com_soros.py", line 326, in <module> id) File "/Users/valderi/Documents/iqoptionapi/iqoptionapi/stable_api.py", line 714, in check_win_digital check, data = self.get_position(buy_order_id) File "/Users/valderi/Documents/iqoptionapi/iqoptionapi/stable_api.py", line 845, in get_position self.api.get_position(position_id) File "/Users/valderi/Documents/iqoptionapi/iqoptionapi/ws/chanels/get_positions.py", line 26, in __call__ self.send_websocket_request(self.name, data) File "/Users/valderi/Documents/iqoptionapi/iqoptionapi/ws/chanels/base.py", line 23, in send_websocket_request return self.api.send_websocket_request(name, msg,request_id) File "/Users/valderi/Documents/iqoptionapi/iqoptionapi/api.py", line 243, in send_websocket_request self.websocket.send(data) File "/usr/local/lib/python3.7/site-packages/websocket/_app.py", line 147, in send if not self.sock or self.sock.send(data, opcode) == 0: File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 240, in send return self.send_frame(frame) File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 265, in send_frame l = self._send(data) File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 430, in _send return send(self.sock, data) File "/usr/local/lib/python3.7/site-packages/websocket/_socket.py", line 117, in send return sock.send(data) File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 984, in send return self._sslobj.write(data) OSError: [Errno 22] Invalid argument
PS: before the code update I could run for a lot of hours in a row without get any error.
Replace on the last lines: I_want_money.unsubscribe_strike_list(buy) by: I_want_money.unsubscribe_strike_list(goal)
@valderind4 thank ,i will check id problem
Hello @Lu-Yi-Hsun any news about the problem regarding order id?
@valderind4 thank ,i will check id problem
Hello @Lu-Yi-Hsun any news about the problem regarding order id?
News?
@valderind4 thank ,i will check id problem
Hello @Lu-Yi-Hsun any news about the problem regarding order id?
News?
I thank so much to @Lu-Yi-Hsun for his great job, but It so important to get the spot price. So far, we can only wait for it.
Hello @Lu-Yi-Hsun the API development is stopped? We need just get the return (win or loss) for buy digital spot method because no method that exists right now can get the correct return and the check_digital_win return order id not found since the buy digital spot returns the digital option id instead of the order id, please help us!!!
@thiagottjv How is it going Your PHP api Will You put it on Github?
@valderind4 Unfortunately I wont be making an api on PHP. What I did was just a one page class including the websocket connection and the request to connect. Thats basically it. After that you send requests to subscribe to the candle stream and buy when its time.
@valderind4 Unfortunately I wont be making an api on PHP. What I did was just a one page class including the websocket connection and the request to connect. Thats basically it. After that you send requests to subscribe to the candle stream and buy when its time.
Tks for your answser I got what you said, my problem is on getting the return (win or loss).
Iq option is update the server ,so some api can not working , I am fix check win for now
Iq option is update the server ,so some api can not working , I am fix check win for now
Thank You so much @Lu-Yi-Hsun because check win is, for now, the only thing that makes the API not working for me.
Hi @Lu-Yi-Hsun
Thanks for the great work. Is this fixed yet? buy_order_id
is still None
though.
Hi @Lu-Yi-Hsun First of All I want thank you for the iqoptionapi and second I just wanna ask you about how to get the correct profit on digital market, coz i'm using the code below and doesn't work. The result showed me 87% but on IQOption Plataform was 20%. Could you or Anyone that read it, help me with that.
def procura_abertas(tipo): paridades = API.get_all_open_time() abertas = [] if tipo != 'digital': for par in paridades['binary']: if paridades['binary'][par]['open']: abertas.append(par) else: for par in paridades['digital']: if paridades['digital'][par]['open']: abertas.append(par)
return abertas
par = API.get_all_open_time() if str(modalidade[0]) == 'd' or str(modalidade[0]) == 'D': for paridade in par['turbo']: if par['turbo'][paridade]['open'] == True: profit = False API.subscribe_strike_list(paridade,1) while profit == False: profit = API.get_digital_current_profit(paridade,1) if profit != False: profit = int(profit) API.unsubscribe_strike_list(paridade,1) print('Opção Digital:', paridade,'-',str(profit),'% está ativa!') else: for paridade in par['binary']: if par['binary'][paridade]['open'] == True: print('Opção Binária:', paridade,'-',str(payout2(paridade, 'binary')),'% está ativa!')
Hi,
I am using iqoptionapi for my python code. i am still getting error in check_win_digital_v2.Please help me
Hi my friend,
Could you please tell me (and write) a code where I can buy a digital option (for example EURUSD digital) where as buy price I have the actual price?
Now on IQ Option you can buy digitals both setting a specific price or with the actual price (with a fixed payout associated). I would be interested into this second way. Could you help me?
Thanks!