GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mdn522/binaryapi: Binary.com & Deriv.com API for Python

BranchesTags
Open more actions menu

Latest commit

 

History

64 Commits
64 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
binaryapi
binaryapi
 
 
docs
docs
 
 
examples
examples
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 
setup.py
setup.py
 
 

Repository files navigation

Binary.com & Deriv.com API for Python

Donate

Documentation

Documentation is also available online at https://binaryapi.readthedocs.io


About API

# 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

Compatibility

Requires Python 3.7.0 or later.


Installing and Updating

pip install -U git+https://github.com/mdn522/binaryapi.git

Must have git installed


Getting Started

from binaryapi.stable_api import Binary

binary_token = "YOUR-API-TOKEN-GOES-HERE"

binary = Binary(token=binary_token)

symbol = "frxEURUSD"  # symbol/asset

print("Buy a [CALL] contract")
success, contract_id, req_id = binary.buy('CALL', amount=1, symbol=symbol, duration=5, duration_unit='t')

print('success={}, contract_id={}, req_id={}'.format(success, contract_id, req_id))

Document

Import

from binaryapi.stable_api import Binary

Enabling Debug Logs

import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s')

Authorize/Login

binary = Binary(token="YOUR-API-TOKEN-GOES-HERE")

*It automatically subscribes to balance and transaction API


Authorize/Login with a message handler function

def message_handler(message):
    msg_type = message.get('msg_type')
    
    print(msg_type, "=>", message)

    
binary = Binary(token="YOUR-API-TOKEN-GOES-HERE", message_callback=message_handler)

I tried to add every API function available in Binary.com API documentation to this library, which you can call by accessing api variable of stable API

Examples:

binary = Binary(token="YOUR-API-TOKEN-GOES-HERE")

# Buy API - https://developers.binary.com/api/#buy
binary.api.buy(buy, price, parameters=None, subscribe=None, passthrough=None, req_id=None)
# You must pass values for "buy" and "price" arguments

# Proposal API - https://developers.binary.com/api/#proposal
binary.api.proposal(contract_type, currency, symbol, amount=None, barrier=None, barrier2=None, basis=None, cancellation=None, date_expiry=None, date_start=None, duration=None, duration_unit=None, limit_order=None, multiplier=None, product_type=None, selected_tick=None, subscribe=None, trading_period_start=None, passthrough=None, req_id=None)
# You must pass values for "contract_type", "currency" and "symbol" arguments

# Subscribe to Ticks API - https://developers.binary.com/api/#ticks
binary.api.ticks(ticks="frxEURUSD", subscribe=None, passthrough=None, req_id=None)

# For More API functions/endpoints please refer to https://developers.binary.com/api/

About

Binary.com & Deriv.com API for Python

binaryapi.readthedocs.io/

Topics

apiapi-clientautomated-tradingbinarybinary-apibinary-combinary-optionsderiv-apideriv-comforeign-exchangeforexforex-tradingmoneyoptions-tradingpythontradingtrading-bottrading-robot

Resources

Readme
GPL-3.0 license
Activity

Stars

57 stars

Watchers

7 watching

Forks

39 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.