Giter VIP home page Giter VIP logo

python-hotbit's Introduction

Python-Hotbit

A Python package for the cryptocurrency exchange Hotbit that doesn't require an API Key, making it available to everyone.

The package also work with official api keys, if you want help getting one, join my Discord.

This is still at the development stage which is why not all endpoints are covered.

It's time to take a bow

As some of you might now, Hotbit has closed down. Do to this I will be archiving this project.
You can read more here: https://hotbit.zendesk.com/hc/en-us/articles/14750194236823

Please notice I am not involved with Hotbit and has never worked for them. I cannot do anything about their decision.

This repo will remain up, in case anyone finds it interesting.

Installation

pip install hotbit

or

pip install python-hotbit

Help/Discord

Join click here to join our Discord, we're always happy to help.

Common errors

If you are experiencing errors please try to type this in the terminal:

$ pip install --upgrade requestsWS
$ pip install git+https://github.com/websocket-client/websocket-client.git

Documentation

Auth

Email, Password, 2FA

For this method the either Anti-Captcha or 2Captcha is needed
Please notice the price of login is about $0.0019 on Anti-Captcha and about $0.0029 on 2Captcha, as they charge for the captcha solving.
If you don't want to pay you can use either Key/Secret or Cookie as the authorization method.

import hotbit

email = "[email protected]"
password = "MyPassword"
authenticatorCode = "MyAuthenticatorCode"

captchaKey = "My 2Captcha Key or Anti-Captcha Key"

auth = hotbit.auth.login(email=email, password=password, authenticatorCode=authenticatorCode, antiCaptcha=captchaKey) #If you use 2Captcha write twoCaptcha instead of antiCaptcha
Client = hotbit.Hotbit(auth)

Official API (Key/Secret)

If you want help gaining access to the official api, join the Discord.

import hotbit

auth = hotbit.auth.api(api_key="My API Key", api_secret="My API Secret")
client = hotbit.Hotbit(auth)

Cookie

import hotbit

auth = hotbit.auth.cookie(cookies="My Cookie String")
client = hotbit.Hotbit(auth)

Hotbit

Server Time

Get the server time of Hotbit.

client.serverTime()

Place Order

Buy/sell something.

client.order(market="ADA/USDT", side="BUY", amount=10, price=0.6)

Cancel Order

Cancel a select order.

client.cancelOrder(market="ADA/USDT", order_id="4365873")

Balance Query

Query your balance on Hotbit.

client.balanceQuery()

Market Price

Retrieve the instant buy/sell price of a select market.
This function has some logic behind it meaning it does not only use Hotbit's endpoints to calculate.

market = "ADA/USDT"
side = "BUY"
amount = 1000 # USDT (Last part of market)

client.marketPrice(market=market, side=side, amount=amount)

Depth Query

Query ask and bid prices and amount.

market = "ADA/USDT"
client.depthQuery(market)

Market List

Retrieve a list of all markets.

client.marketList()

Allticker

Retreve a list over all tickers.

client.allticker()

Allticker

Get the order history.

client.fetchOrderHistory(since)

HTTP

This only works when using the official API. Endpoints can be found here: https://hotbitex.github.io/slate/docs/spot/v2/en.

urlPath = "/p2/balance.query"
payload = 'assets=[]'

client.http(urlPath, payload).json()

python-hotbit's People

Contributors

1220moritz avatar dri94 avatar jona799t avatar titodra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

python-hotbit's Issues

Doc Enhancement: Add Response samples

Since there is not test api for reverseApi users, it would be great to include sample success/error responses for each example in the doc. This will help users test their code without the need for a test API. Some endpoints do not follow the docs response exactly as well so it's good to know what to expect.

Limit Sell

The documentation doesn't show how to do a limit sell or buy. Can this be added?

Error

Hi,

I am executing sample code but getting following error

Code:

import sys
import hotbit


try:
	authenticatorCode = sys.argv[1]
except Exception as e:
	raise e

email = "xxx"
password = "xxx"


captchaKey = "xxxxxxxxxxxx"

auth = hotbit.auth.login(email=email, password=password, authenticatorCode=authenticatorCode, antiCaptcha=captchaKey) #If you use 2Captcha write twoCaptcha instead of antiCaptcha



client = hotbit.Hotbit(auth)

print(client.balanceQuery())

Error:

Traceback (most recent call last):
  File "/Volumes/MacintoshHD/python/hotbit-bot/main.py", line 19, in <module>
    client = hotbit.Hotbit(auth)
  File "/usr/local/lib/python3.9/site-packages/hotbit/__init__.py", line 6, in Hotbit
    return Hotbit(auth)
  File "/usr/local/lib/python3.9/site-packages/hotbit/reverseApi.py", line 37, in __init__
    self.sessionWS.post('wss://ws.hotbit.io/', json=payload, encryption="gzip", identifiers={"id": 300})
  File "/usr/local/lib/python3.9/site-packages/requestsWS/session.py", line 128, in post
    resp = _post(ws=self.ws, wsUrl=wsUrl, wsData=self.wsData, headers=headers, encryption=encryption, data=data, json=json, waitForResponse=waitForResponse, identifiers=identifiers, timeout=timeout, debug=debug)
  File "/usr/local/lib/python3.9/site-packages/requestsWS/session.py", line 68, in __init__
    ws = create_connection(wsUrl, header=headers, enable_multithread=True)
  File "/usr/local/lib/python3.9/site-packages/websocket/_core.py", line 596, in create_connection
    websock.connect(url, **options)
  File "/usr/local/lib/python3.9/site-packages/websocket/_core.py", line 253, in connect
    self.handshake_response = handshake(self.sock, *addrs, **options)
  File "/usr/local/lib/python3.9/site-packages/websocket/_handshake.py", line 51, in handshake
    headers, key = _get_handshake_headers(resource, hostname, port, options)
  File "/usr/local/lib/python3.9/site-packages/websocket/_handshake.py", line 98, in _get_handshake_headers
    if 'header' not in options or 'Sec-WebSocket-Key' not in options['header']:
TypeError: argument of type 'NoneType' is not iterable

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.