Get start¶
document version¶
v1.4 fix realtime candle and update websocket-client==1.6.2
v1.2 fix get_balance
v1.1 fix login error
fix buy,fix get_server_time
2/13 v0.8 fix ssid login problem
12/2 0.7 try connect stable
11/6 v0.5 check_win_v2 fix connect problem 8/16 v0.3 update fix buy
v0.1 !!!Start New!!
Debug Mode ON¶
import logging
logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')
Login by email/password¶
Binomo can not login by email/password because that is protect by google
Login by ssid¶
from binomoapi.stable_api import Binomo
ssid="""authtoken=75652ed1-c071-4a53-96d1-532a115a928f; __exponea_etc__=ccf8ea68-95c4-4dd0-aa0c-6503b4c9d504; __exponea_time2__=1.961256742477417; _gcl_au=1.1.601922402.1684612741; _ga=GA1.2.1358679556.1684612742; _gid=GA1.2.971074886.1684612742; device_id=820346f9355e32619c5c1fece9cfc995; device_type=web; _dc_gtm_UA-60335261-1=1"""
account=Binomo(set_ssid=ssid)
check_connect,message=account.connect()
print(check_connect,message)
check_win & buy sample¶
you can try check_win_v2 or check_win two different solution
from binomoapi.stable_api import Binomo
ssid="""authtoken=75652ed1-c071-4a53-96d1-532a115a928f; __exponea_etc__=ccf8ea68-95c4-4dd0-aa0c-6503b4c9d504; __exponea_time2__=1.961256742477417; _gcl_au=1.1.601922402.1684612741; _ga=GA1.2.1358679556.1684612742; _gid=GA1.2.971074886.1684612742; device_id=820346f9355e32619c5c1fece9cfc995; device_type=web; _dc_gtm_UA-60335261-1=1"""
account=Binomo(set_ssid=ssid)
check_connect,message=account.connect()
asset="Z-CRY/IDX"
amount=1
dir="call"
check,data=account.buy(asset,amount,dir,1)
if check:
uuid=data["uuid"]
print(account.check_win(uuid))
get_server_time¶
from binomoapi.stable_api import Binomo
import time
ssid="""authtoken=75652ed1-c071-4a53-96d1-532a115a928f; __exponea_etc__=ccf8ea68-95c4-4dd0-aa0c-6503b4c9d504; __exponea_time2__=1.961256742477417; _gcl_au=1.1.601922402.1684612741; _ga=GA1.2.1358679556.1684612742; _gid=GA1.2.971074886.1684612742; device_id=820346f9355e32619c5c1fece9cfc995; device_type=web; _dc_gtm_UA-60335261-1=1"""
account=Binomo(set_ssid=ssid)
check,message=account.connect()
if check:
while True:
print(account.get_server_time())
time.sleep(1)
Get Balance¶
from binomoapi.stable_api import Binomo
ssid="""authtoken=75652ed1-c071-4a53-96d1-532a115a928f; __exponea_etc__=ccf8ea68-95c4-4dd0-aa0c-6503b4c9d504; __exponea_time2__=1.961256742477417; _gcl_au=1.1.601922402.1684612741; _ga=GA1.2.1358679556.1684612742; _gid=GA1.2.971074886.1684612742; device_id=820346f9355e32619c5c1fece9cfc995; device_type=web; _dc_gtm_UA-60335261-1=1"""
account=Binomo(set_ssid=ssid)
check,message=account.connect()
account.change_balance("PRACTICE")
balance=account.get_balance()
print(balance)
Buy¶
from binomoapi.stable_api import Binomo
ssid="""authtoken=75652ed1-c071-4a53-96d1-532a115a928f; __exponea_etc__=ccf8ea68-95c4-4dd0-aa0c-6503b4c9d504; __exponea_time2__=1.961256742477417; _gcl_au=1.1.601922402.1684612741; _ga=GA1.2.1358679556.1684612742; _gid=GA1.2.971074886.1684612742; device_id=820346f9355e32619c5c1fece9cfc995; device_type=web; _dc_gtm_UA-60335261-1=1"""
account=Binomo(set_ssid=ssid)
check,message=account.connect()
if check:
account.change_balance("PRACTICE")
asset="Z-CRY/IDX"
amount=1
dir="call"#"call"/"put"
duration=1#minute
print(account.buy(asset,amount,dir,duration))
sell_option¶
binomo not have sell option
get candle¶
you need setting three value you want
utc_time_start_time utc_time_end_time time_step
from binomoapi.stable_api import Binomo
import datetime
ssid="""authtoken=75652ed1-c071-4a53-96d1-532a115a928f; __exponea_etc__=ccf8ea68-95c4-4dd0-aa0c-6503b4c9d504; __exponea_time2__=1.961256742477417; _gcl_au=1.1.601922402.1684612741; _ga=GA1.2.1358679556.1684612742; _gid=GA1.2.971074886.1684612742; device_id=820346f9355e32619c5c1fece9cfc995; device_type=web; _dc_gtm_UA-60335261-1=1"""
account=Binomo(set_ssid=ssid)
#check_connect,message=account.connect() not need login can work
asset="Z-CRY/IDX"
#you want candle start time at
utc_time_start_time=datetime.datetime(2021, 1, 1, 0, 0, 0, 0)
#you want candle end time at
utc_time_end_time=datetime.datetime(2021, 8, 10, 0, 0, 0, 0)
#time step
time_step=900#
while True:
a=utc_time_start_time.strftime('%Y-%m-%dT%H:%M:00')
candle=account.get_candle(asset,a,time_step)
if len(candle["data"])==0:
utc_time_start_time=utc_time_start_time-datetime.timedelta(days=1)
continue
k=[]
print(candle)
date_time_str=candle["data"][-1]["created_at"]
date_time_obj = datetime.datetime.strptime(date_time_str, '%Y-%m-%dT%H:%M:%S.000000Z')
date_time_shift_obj=date_time_obj-utc_time_start_time
utc_time_start_time=utc_time_start_time+date_time_shift_obj
if date_time_obj>=utc_time_end_time:
break
GET realtime candle¶
from binomoapi.stable_api import Binomo
import time
ssid="""authtoken=75652ed1-c071-4a53-96d1-532a115a928f; __exponea_etc__=ccf8ea68-95c4-4dd0-aa0c-6503b4c9d504; __exponea_time2__=1.961256742477417; _gcl_au=1.1.601922402.1684612741; _ga=GA1.2.1358679556.1684612742; _gid=GA1.2.971074886.1684612742; device_id=820346f9355e32619c5c1fece9cfc995; device_type=web; _dc_gtm_UA-60335261-1=1"""
account=Binomo(set_ssid=ssid)
check_connect,message=account.connect()
if check_connect:
asset="Z-CRY/IDX"
asset2="ALTHUOB/BTC-CXDX"
def candle_message(wss,raw_message_s):
print(raw_message_s,asset)
def candle_message2(wss,raw_message_s):
print(raw_message_s,asset2)
account.start_candles_stream(asset,candle_message)
account.start_candles_stream(asset2,candle_message2)
time.sleep(100)
get_payment and check asset open¶
payment have different mode "free"/"standard"/"gold"/"vip"
from binomoapi.stable_api import Binomo
ssid="""authtoken=75652ed1-c071-4a53-96d1-532a115a928f; __exponea_etc__=ccf8ea68-95c4-4dd0-aa0c-6503b4c9d504; __exponea_time2__=1.961256742477417; _gcl_au=1.1.601922402.1684612741; _ga=GA1.2.1358679556.1684612742; _gid=GA1.2.971074886.1684612742; device_id=820346f9355e32619c5c1fece9cfc995; device_type=web; _dc_gtm_UA-60335261-1=1"""
account=Binomo(set_ssid=ssid)
check_connect,message=account.connect()
if check_connect:
all_data=account.get_payment("free")#"free"/"standard"/"gold"/"vip"
for asset_name in all_data:
asset_data=all_data[asset_name]
#asset_data["open"] can check asset open
print(asset_name,asset_data["payment"],asset_data["open"])