Skip to content

Commit 1c41c17

Browse files
committed
pushback
1 parent 88a7da4 commit 1c41c17

File tree

1 file changed

+248
-0
lines changed

1 file changed

+248
-0
lines changed

README.md

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
# bitmex-python
2+
Python SDK (sync and async) for Bitmex cryptocurrency exchange with Rest and WS capabilities.
3+
4+
You can check the SDK docs here: [SDK](https://docs.ccxt.com/#/exchanges/bitmex)
5+
You can check Bitmex's docs here: [Docs](https://ccxt.com)
6+
7+
8+
## Installation
9+
10+
```
11+
pip install __PYTHON_PACKAGE_NAME__
12+
```
13+
14+
## Usage
15+
16+
### Sync
17+
18+
```Python
19+
from bitmex import BitmexSync
20+
21+
def main():
22+
instance = BitmexSync({})
23+
ob = instance.fetch_order_book("BTC/USDC")
24+
print(ob)
25+
#
26+
# balance = instance.fetch_balance()
27+
# order = instance.create_order("BTC/USDC", "limit", "buy", 1, 100000)
28+
```
29+
30+
### Async
31+
32+
```Python
33+
import asyncio
34+
from bitmex import BitmexAsync
35+
36+
async def main():
37+
instance = BitmexAsync({})
38+
ob = await instance.fetch_order_book("BTC/USDC")
39+
print(ob)
40+
#
41+
# balance = await instance.fetch_balance()
42+
# order = await instance.create_order("BTC/USDC", "limit", "buy", 1, 100000)
43+
44+
asyncio.run(main())
45+
```
46+
47+
48+
49+
### Websockets
50+
51+
```Python
52+
from bitmex import BitmexWs
53+
54+
async def main():
55+
instance = BitmexWs({})
56+
while True:
57+
ob = await instance.watch_order_book("BTC/USDC")
58+
print(ob)
59+
# orders = await instance.watch_orders("BTC/USDC")
60+
```
61+
62+
63+
64+
65+
66+
#### Raw call
67+
68+
You can also construct custom requests to available "implicit" endpoints
69+
70+
```Python
71+
request = {
72+
'type': 'candleSnapshot',
73+
'req': {
74+
'coin': coin,
75+
'interval': tf,
76+
'startTime': since,
77+
'endTime': until,
78+
},
79+
}
80+
response = await instance.public_post_info(request)
81+
```
82+
83+
84+
85+
86+
## Available methods
87+
88+
### REST Unified
89+
90+
- `create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})`
91+
- `fetch_balance(self, params={})`
92+
- `fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
93+
- `fetch_currencies(self, params={})`
94+
- `fetch_deposit_address(self, code: str, params={})`
95+
- `fetch_deposit_withdraw_fees(self, codes: Strings = None, params={})`
96+
- `fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={})`
97+
- `fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
98+
- `fetch_funding_rates(self, symbols: Strings = None, params={})`
99+
- `fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={})`
100+
- `fetch_leverages(self, symbols: Strings = None, params={})`
101+
- `fetch_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={})`
102+
- `fetch_markets(self, params={})`
103+
- `fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
104+
- `fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={})`
105+
- `fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
106+
- `fetch_order_book(self, symbol: str, limit: Int = None, params={})`
107+
- `fetch_order(self, id: str, symbol: Str = None, params={})`
108+
- `fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
109+
- `fetch_positions(self, symbols: Strings = None, params={})`
110+
- `fetch_ticker(self, symbol: str, params={})`
111+
- `fetch_tickers(self, symbols: Strings = None, params={})`
112+
- `fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={})`
113+
- `amount_to_precision(self, symbol, amount)`
114+
- `calculate_rate_limiter_cost(self, api, method, path, params, config={})`
115+
- `cancel_all_orders_after(self, timeout: Int, params={})`
116+
- `cancel_all_orders(self, symbol: Str = None, params={})`
117+
- `cancel_order(self, id: str, symbol: Str = None, params={})`
118+
- `cancel_orders(self, ids, symbol: Str = None, params={})`
119+
- `convert_from_raw_cost(self, symbol, rawQuantity)`
120+
- `convert_from_raw_quantity(self, symbol, rawQuantity, currencySide='base')`
121+
- `convert_from_real_amount(self, code, amount)`
122+
- `convert_to_real_amount(self, code: Str, amount: Str)`
123+
- `describe(self)`
124+
- `edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={})`
125+
- `nonce(self)`
126+
- `set_leverage(self, leverage: Int, symbol: Str = None, params={})`
127+
- `set_margin_mode(self, marginMode: str, symbol: Str = None, params={})`
128+
- `withdraw(self, code: str, amount: float, address: str, tag=None, params={})`
129+
130+
### REST Raw
131+
132+
- `public_get_announcement(request)`
133+
- `public_get_announcement_urgent(request)`
134+
- `public_get_chat(request)`
135+
- `public_get_chat_channels(request)`
136+
- `public_get_chat_connected(request)`
137+
- `public_get_chat_pinned(request)`
138+
- `public_get_funding(request)`
139+
- `public_get_guild(request)`
140+
- `public_get_instrument(request)`
141+
- `public_get_instrument_active(request)`
142+
- `public_get_instrument_activeandindices(request)`
143+
- `public_get_instrument_activeintervals(request)`
144+
- `public_get_instrument_compositeindex(request)`
145+
- `public_get_instrument_indices(request)`
146+
- `public_get_instrument_usdvolume(request)`
147+
- `public_get_insurance(request)`
148+
- `public_get_leaderboard(request)`
149+
- `public_get_liquidation(request)`
150+
- `public_get_orderbook_l2(request)`
151+
- `public_get_porl_nonce(request)`
152+
- `public_get_quote(request)`
153+
- `public_get_quote_bucketed(request)`
154+
- `public_get_schema(request)`
155+
- `public_get_schema_websockethelp(request)`
156+
- `public_get_settlement(request)`
157+
- `public_get_stats(request)`
158+
- `public_get_stats_history(request)`
159+
- `public_get_stats_historyusd(request)`
160+
- `public_get_trade(request)`
161+
- `public_get_trade_bucketed(request)`
162+
- `public_get_wallet_assets(request)`
163+
- `public_get_wallet_networks(request)`
164+
- `private_get_address(request)`
165+
- `private_get_apikey(request)`
166+
- `private_get_execution(request)`
167+
- `private_get_execution_tradehistory(request)`
168+
- `private_get_globalnotification(request)`
169+
- `private_get_leaderboard_name(request)`
170+
- `private_get_order(request)`
171+
- `private_get_porl_snapshots(request)`
172+
- `private_get_position(request)`
173+
- `private_get_user(request)`
174+
- `private_get_user_affiliatestatus(request)`
175+
- `private_get_user_checkreferralcode(request)`
176+
- `private_get_user_commission(request)`
177+
- `private_get_user_csa(request)`
178+
- `private_get_user_depositaddress(request)`
179+
- `private_get_user_executionhistory(request)`
180+
- `private_get_user_getwallettransferaccounts(request)`
181+
- `private_get_user_margin(request)`
182+
- `private_get_user_quotefillratio(request)`
183+
- `private_get_user_quotevalueratio(request)`
184+
- `private_get_user_staking(request)`
185+
- `private_get_user_staking_instruments(request)`
186+
- `private_get_user_staking_tiers(request)`
187+
- `private_get_user_tradingvolume(request)`
188+
- `private_get_user_unstakingrequests(request)`
189+
- `private_get_user_wallet(request)`
190+
- `private_get_user_wallethistory(request)`
191+
- `private_get_user_walletsummary(request)`
192+
- `private_get_useraffiliates(request)`
193+
- `private_get_userevent(request)`
194+
- `private_post_address(request)`
195+
- `private_post_chat(request)`
196+
- `private_post_guild(request)`
197+
- `private_post_guild_archive(request)`
198+
- `private_post_guild_join(request)`
199+
- `private_post_guild_kick(request)`
200+
- `private_post_guild_leave(request)`
201+
- `private_post_guild_sharestrades(request)`
202+
- `private_post_order(request)`
203+
- `private_post_order_cancelallafter(request)`
204+
- `private_post_order_closeposition(request)`
205+
- `private_post_position_isolate(request)`
206+
- `private_post_position_leverage(request)`
207+
- `private_post_position_risklimit(request)`
208+
- `private_post_position_transfermargin(request)`
209+
- `private_post_user_addsubaccount(request)`
210+
- `private_post_user_cancelwithdrawal(request)`
211+
- `private_post_user_communicationtoken(request)`
212+
- `private_post_user_confirmemail(request)`
213+
- `private_post_user_confirmwithdrawal(request)`
214+
- `private_post_user_logout(request)`
215+
- `private_post_user_preferences(request)`
216+
- `private_post_user_requestwithdrawal(request)`
217+
- `private_post_user_unstakingrequests(request)`
218+
- `private_post_user_updatesubaccount(request)`
219+
- `private_post_user_wallettransfer(request)`
220+
- `private_put_guild(request)`
221+
- `private_put_order(request)`
222+
- `private_delete_order(request)`
223+
- `private_delete_order_all(request)`
224+
- `private_delete_user_unstakingrequests(request)`
225+
226+
### WS Unified
227+
228+
- `describe(self)`
229+
- `watch_ticker(self, symbol: str, params={})`
230+
- `watch_tickers(self, symbols: Strings = None, params={})`
231+
- `watch_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={})`
232+
- `watch_liquidations_for_symbols(self, symbols: List[str] = None, since: Int = None, limit: Int = None, params={})`
233+
- `watch_balance(self, params={})`
234+
- `watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={})`
235+
- `authenticate(self, params={})`
236+
- `watch_positions(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={})`
237+
- `watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
238+
- `watch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
239+
- `watch_order_book(self, symbol: str, limit: Int = None, params={})`
240+
- `watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={})`
241+
- `watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={})`
242+
- `watch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={})`
243+
- `watch_heartbeat(self, params={})`
244+
245+
## Contribution
246+
- Give us a star :star:
247+
- Fork and Clone! Awesome
248+
- Select existing issues or create a new issue.

0 commit comments

Comments
 (0)