Skip to main content

nobitexv2

install (نصب)

pip install nobitexv2

example usage (استفاده نمونه)

نمونه استفاده از nobitexv2. اسکریپتی که روزانه با استفاده از moving average سفارشتان market خرید و فروش میذارد.(بازار BTCUSDT)

import time
import requests
from datetime import datetime,timedelta
from nobitexv2 import NobitexV2

# توکن خودت رو میتونی از پنل بگیری یا متد auth_login
# https://apidocs.nobitex.ir/#login
nv2=NobitexV2(requests.Session()) # توکن رو از environment variables 'NOBITEX_TOKEN' میگیره

while True:
    # BTCUSDT OHLCV data
    history=nv2.market_udf_history(to=time.time(),
                            from_=(datetime.now()-timedelta(days=10)).timestamp(), # 10 days before
                            symbol='BTCUSDT',
                            resolution='D')
    # closing prices (oldest0 to news)
    closingprices=history['c']
    # last trade price
    last_trade_price=float(nv2.orderbook('BTCUSDT')['lastTradePrice'])
    print("BTCUSDT last trade price:",last_trade_price)
    # select usdt wallet from wallets
    usdt_wallet=[wallet for wallet in nv2.wallets_list()['wallets'] if wallet['currency']=='usdt'][0]
    # usdt balance available to trade
    usdt_balance=float(usdt_wallet['balance'])-float(usdt_wallet['blockedBalance'])
    print("usdt balance available to trade:",usdt_balance)
    if usdt_balance<5.1:
        print('balance less than minimum trade requirement')
        break
    # SMA10 value
    mean=sum(closingprices)/len(closingprices)
    
    trade_amount=usdt_balance*0.5/last_trade_price # 50% of the usdt balance
    # market buy if current price is higher than SMA10
    if last_trade_price>mean:
        print(f"buying {trade_amount} btc")
        nv2.add_spot_order(
            type='buy',
            execution='market',
            srcCurrency='btc',
            dstCurrency='usdt',
            amount=trade_amount
        )
    else: # sell otherwise
        print(f"selling {trade_amount} btc")
        nv2.add_spot_order(
            type='sell',
            execution='market',
            srcCurrency='btc',
            dstCurrency='usdt',
            amount=trade_amount
        )
    
    # iterate after a day
    time.sleep(timedelta(days=1).total_seconds())

implementation progress nobitex docs

مواردی که 🟩 گذاشته شده پیاده سازی شده اند. 🟧 ناقص. 🟥 پیاده سازی نشده

بخش وضیعت
اطلاعات بازار (عمومی) 🟩
اطلاعات کاربر 🟧
معامله در بازار اسپات 🟩
معامله در بازار تعهدی 🟧
برداشت 🟥
وب‌سوکت (آزمایشی) 🟥
دفتر آدرس و حالت برداشت امن 🟥
امنیت 🟥
احراز هویت 🟩
سود و زیان 🟥
طرح معرفی دوستان 🟥
سایر 🟥

Metadata

Release files for nobitexv2 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nobitexv2 0.2.0
File Size Uploaded Provenance Actions
nobitexv2-0.2.0.tar.gz 7.6 kB Without provenance Details for nobitexv2-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nobitexv2 0.2.0
File Interpreter ABI Platform Actions
nobitexv2-0.2.0-py3-none-any.whl Python 3 none any Details for nobitexv2-0.2.0-py3-none-any.whl

Total release size: 15.8 kB

Release files / nobitexv2-0.2.0.tar.gz

Download URL nobitexv2-0.2.0.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
39bdc7dea1ec57c119ca312c6f55e401bf99e6670a0be25ea3e925d03d57e3a3
BLAKE2b-256 checksum
How to use checksums
085a60cb27958a441bf8a94e4ff247dfaa2c417462eb2fb8b0432737096d6edc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / nobitexv2-0.2.0-py3-none-any.whl

Download URL nobitexv2-0.2.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3906fb45ae867f3dda7a3625a5fd83bde035aed2585b624aa897d9aa5bd6c42
BLAKE2b-256 checksum
How to use checksums
12ddf0371d4f8688f056abfc242e7082f1e496e30463a7f1812afa4e0c5ee0ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Security for nobitexv2 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page