FastAPI_Bitget_API_Bot

仅实现个人需要的功能

场景为交易员,普通场景也适用

因BG的API限制,所以用同步模式实现, sleep是防止触发API的频繁访问限制

Install

pip install "fastapi[all]"

Run

Dev

uvicorn main:app --reload

Online

nohup uvicorn main:app --host 0.0.0.0 --port 80 &

Docker

  1. Create myapi.config in app/
  2. Build docker image
docker build -t fastapi .
  1. Run example
docker run -d --restart=always --name fastAPI -p 3001:80 fastapi

信号 example (Tradingview)

{
    "symbol": "{{exchange}}:{{ticker}}",
    "long_price": {{plot_0}},
    "stop_long": {{plot_1}},
    "short_price": {{plot_2}},
    "stop_short": {{plot_3}},
    "curr_price": {{close}},
    "action": "status"
}

action = {status, open, add}

Post json to https://xxx.com/tv_order_trend/

策略 example (Tradingview)

{
    "order_action": "{{strategy.order.action}}",
    "order_contracts": "{{strategy.order.contracts}}",
    "ticker": "{{ticker}}",
    "position_size": "{{strategy.position_size}}"
}

Post json to https://xxx.com/tv_order_er/