Implement more endpoints
This commit is contained in:
parent
5e4c4cae06
commit
4b86700a0f
@ -1,11 +1,12 @@
|
|||||||
from datetime import datetime, timedelta
|
|
||||||
import secrets
|
import secrets
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
import jwt
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
||||||
|
from fastapi.security import OAuth2PasswordBearer
|
||||||
from fastapi.security.http import HTTPBasic, HTTPBasicCredentials
|
from fastapi.security.http import HTTPBasic, HTTPBasicCredentials
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
import jwt
|
|
||||||
from fastapi.security import OAuth2PasswordBearer
|
|
||||||
from freqtrade.rpc.api_server2.api_models import AccessAndRefreshToken, AccessToken
|
from freqtrade.rpc.api_server2.api_models import AccessAndRefreshToken, AccessToken
|
||||||
|
|
||||||
from .deps import get_config
|
from .deps import get_config
|
||||||
|
@ -39,3 +39,9 @@ class Balances(BaseModel):
|
|||||||
value: float
|
value: float
|
||||||
stake: str
|
stake: str
|
||||||
note: str
|
note: str
|
||||||
|
|
||||||
|
|
||||||
|
class Count(BaseModel):
|
||||||
|
current: int
|
||||||
|
max: int
|
||||||
|
total_stake: float
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
from freqtrade.rpc import RPC
|
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
from freqtrade import __version__
|
from freqtrade import __version__
|
||||||
|
from freqtrade.rpc import RPC
|
||||||
|
|
||||||
from .api_models import Balances, Ping, StatusMsg, Version
|
from .api_models import Balances, Count, Ping, StatusMsg, Version
|
||||||
from .deps import get_config, get_rpc
|
from .deps import get_config, get_rpc
|
||||||
|
|
||||||
|
|
||||||
@ -29,6 +29,16 @@ def balance(rpc: RPC = Depends(get_rpc), config=Depends(get_config)):
|
|||||||
return rpc._rpc_balance(config['stake_currency'], config.get('fiat_display_currency', ''),)
|
return rpc._rpc_balance(config['stake_currency'], config.get('fiat_display_currency', ''),)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get('/count', response_model=Count, tags=['info'])
|
||||||
|
def count(rpc: RPC = Depends(get_rpc)):
|
||||||
|
return rpc._rpc_count()
|
||||||
|
|
||||||
|
|
||||||
|
@router.get('/show_config', tags=['info'])
|
||||||
|
def show_config(rpc: RPC = Depends(get_rpc), config=Depends(get_config)):
|
||||||
|
return RPC._rpc_show_config(config, rpc._freqtrade.state)
|
||||||
|
|
||||||
|
|
||||||
@router.post('/start', response_model=StatusMsg, tags=['botcontrol'])
|
@router.post('/start', response_model=StatusMsg, tags=['botcontrol'])
|
||||||
def start(rpc: RPC = Depends(get_rpc)):
|
def start(rpc: RPC = Depends(get_rpc)):
|
||||||
return rpc._rpc_start()
|
return rpc._rpc_start()
|
||||||
@ -37,3 +47,13 @@ def start(rpc: RPC = Depends(get_rpc)):
|
|||||||
@router.post('/stop', response_model=StatusMsg, tags=['botcontrol'])
|
@router.post('/stop', response_model=StatusMsg, tags=['botcontrol'])
|
||||||
def stop(rpc: RPC = Depends(get_rpc)):
|
def stop(rpc: RPC = Depends(get_rpc)):
|
||||||
return rpc._rpc_stop()
|
return rpc._rpc_stop()
|
||||||
|
|
||||||
|
|
||||||
|
@router.post('/stopbuy', response_model=StatusMsg, tags=['botcontrol'])
|
||||||
|
def stop_buy(rpc: RPC = Depends(get_rpc)):
|
||||||
|
return rpc._rpc_stopbuy()
|
||||||
|
|
||||||
|
|
||||||
|
@router.post('/reload_config', response_model=StatusMsg, tags=['botcontrol'])
|
||||||
|
def reload_config(rpc: RPC = Depends(get_rpc)):
|
||||||
|
return rpc._rpc_reload_config()
|
||||||
|
Loading…
Reference in New Issue
Block a user