Git Product home page Git Product logo

orionx_python_client's Introduction

OrionX GraphQL API Client for Python

This is a lightweight library that works as a client to the OrionX GraphQL API.

Currently supported APIs:

  1. Placing and canceling limit orders.
  2. Retrieving information about user's wallets.

Instalation

pip install orionx-python-client

# Using Poetry
poetry add orionx-python-client@latest

OrionX Api Documentation

http://docs.orionx.com

GraphQL APIS:

Usage Examples:

import os
import asyncio
import logging
from dotenv import load_dotenv

from orionx_python_client import OrionXClient
logging.basicConfig(
    level=logging.INFO, format="%(levelname)s:%(asctime)s:%(message)s\n\t"
)


def main():

    # Load API secrets from environment

    api_key = os.getenv("ORIONX_API_KEY")
    secret_key = os.getenv("ORIONX_API_SECRET")
    api_url = os.getenv("ORIONX_API_URL")

    # Initialize OrionXClient
    ox = OrionXClient(api_key=api_key, secret_key=secret_key, api_url=api_url)

    try:

        # Opening position in BTC/USDT market.
        o1 = ox.new_position(market_code="BTC/USDT", amount=0.0006,
                               limit_price=60000, selling="true")
        logging.info(o1)
        
        # Opening position in BTC/CLP market.
        o2 = ox.new_position(market_code="BTC/CLP", amount=0.0006, limit_price=60000000, selling="true")
        logging.info(o2)

        # Closing Open Positions 
        resp = ox.close_orders(order_ids=[o1, o2])

        print(resp)
    except Exception as err:
        logging.error(err)

if __name__ == "__main__":

    # Load environment variables from file
    load_dotenv(".env")

    # Run Example
    main()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.