GithubHelp home page GithubHelp logo

hamednasimi / nobitex-python-wrapper Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 20 KB

Nobitex API wrapper

License: MIT License

Python 100.00%
api crypto cryptocurrency nobitex nobitex-api trade wrapper wrapper-api

nobitex-python-wrapper's Introduction

Codacy Badge

An unofficial wrapper for the Nobitex crypto exchange API

Currently supports the public API nodes including:

  • The orderbook
  • Market depth
  • Trades
  • Nobitex market stats
  • OHLCV data
  • Global market stats
  • Get user profile data

Get started

import asyncio
from src.client import *

async def main():
    """
    Schedule tasks and get the results ASAP.
    """

    # Create the client
    client = Client()
    
    # If you need account-bound operations, use your token here.
    # client = Client('yourapitokenhere00000000000000000000')

    # Make a try/except block to catch exceptions
    try:
        # Schedule tasks
        tasks = [
            client.get_order_book(symbol=Symbol.BTCUSDT), 
            client.get_market_depth(symbol=Symbol.BTCUSDT), 
            client.get_trades(symbol=Symbol.BTCUSDT), 
            client.get_market_stats(Currency.btc, Currency.ada, destination_currency=Currency.usdt), 
            client.get_global_market_stats(),
            client.get_user_profile(), 
            client.generate_wallet_address(Currency.btc), 
            # client.add_card("bankCARDnumber", "bankNAME"), 
            # client.add_account("bankCARDnumber", "IR0000000000000000000000", "bankNAME"), 
            client.get_user_limitations(), 
            client.get_wallet_list(), 
            client.get_wallets(Currency.usdt, type=TradeType.MARGIN)
            ]

        # Run all of them and catch each result as soon as it's complete
        for future in asyncio.as_completed(tasks):
            result = await future

            # Print the server response in JSON/dictionary format
            print(result)

    except Exception as e:
        print(e)

    finally:
        # You need to close the client connection at the end of the program
        # Avoid creating unique clients for each request
        await client.close()
    
if __name__ == "__main__":
    asyncio.run(main())

The code seems to work reliably if you preserve the pattern above but it is not tested. Use at your own risk.

nobitex-python-wrapper's People

Contributors

hamednasimi avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

alimogh

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.