Python library for cryptocurrency trading using the most common exchanges.
pip install -U crypto-alpine
- Set environment variables (optional)
export API_SECRET_KEY=xxx
export API_ACCESS_KEY=yyy
export API_PASSPHRASE=zzz
- Initialize
from alpine.exchanges import Wrapper
w = Wrapper('bitget')
Note that if you don't want to use enviroment variables (if you wish to use the library within your code), you can define them during the initialization:
from alpine.exchanges import Wrapper
w = Wrapper('bitget', <access_key>, <secret_key>, <passphrase>)
- Set a leverage
w.set_leverage(leverage, position, symbol, margin_coin)
# Example: w.set_leverage(10, "long", "FETUSDT", "usdt")
- Create an order
w.create_order(position, symbol, price, amount, margin_coin, take_profit, stop_loss)
# Example: w.create_order("long", "FETUSDT", 2.5, 100, "usdt", 3, 2)
- Get order detail
w.get_order_detail(symbol, order_id)
# Example: w.get_order_detail("FETUSDT", "123456")
- Get current position detail
w.get_current_position(symbol, margin_coin)
# Example: w.get_current_position("FETUSDT", "usdt")
- Get historical position detail
w.get_historical_position(symbol, margin_coin)
# Example: w.get_historical_position("FETUSDT", "usdt")
- bitget
Please create an issue if you need a feature/exchange to be implemented.
If you wish to support the project:
- Ethereum: 0xf11B49666d3386C96Af1A496bFA5688c83B25E8e
- Solana: C7USpoN4kxEm81w3mpK7FuNQ7zcMWY9fqyuacPafRqnk
- Bitcoin (segwit): bc1qcq7fdn4khlsc5ldmlf0ezks8p9r5q2hn04lyy5