# High Level API, This API is based on "binaryapi.api" for easy usage
from binaryapi.stable_api import Binary
# Low Level API
from binaryapi.api import BinaryAPI
Requires Python 3.7.0 or later.
pip install -U git+https://github.com/mdn522/binaryapi.git
from binaryapi.stable_api import Binary
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s')
binary = Binary(token="YOUR-API-TOKEN-GOES-HERE")
def message_handler(msg):
msg_type = msg.get('msg_type')
print(msg_type, "=>", msg)
binary = Binary(token="YOUR-API-TOKEN-GOES-HERE", message_callback=message_handler)
Note
- In any code example:
binary
is instance ofbinaryapi.stable_api.Binary
binary.api
is instance ofbinaryapi.api.BinaryAPI
- All low level API functions are under
binaryapi.api.BinaryAPI
- So you can call it like
binary.api.buy
,binary.api.ticks_history
, etc. (considering you named the instancebinary
)