Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python sdk cannot execute successfully #38

Open
Pegessi opened this issue May 24, 2023 · 1 comment
Open

python sdk cannot execute successfully #38

Pegessi opened this issue May 24, 2023 · 1 comment

Comments

@Pegessi
Copy link

Pegessi commented May 24, 2023

this is the code about get klines

class BitgetBot():
    def __init__(self, symbol, interval, start_time, end_time):
        self.marketApi = market.MarketApi(API_KEY, SECRET_KEY, PASS_PHRASE, use_server_time=False, first=True);
        self.publicApi = public.PublicApi(API_KEY, SECRET_KEY, PASS_PHRASE, use_server_time=True, first=False);
        self.symbol = symbol
        self.interval = interval
        self.start_time = start_time
        self.end_time = end_time
    
    def get_coin_klines(self):
        klines = self.marketApi.candles(self.symbol, self.interval, self.start_time, self.end_time, 100)
        print(klines)

if __name__ == '__main__':
    delta = pd.Timedelta(hours=6)
    end_time = pd.Timestamp(datetime.now())
    start_time = end_time-delta
    bot = BitgetBot('BTCUSDT_UMCBL', '300', str(int(start_time.timestamp())), str(int(end_time.timestamp())))
    bot.get_coin_klines()

the infomation:

url: https://api.bitget.com/api/mix/v1/market/candles?symbol=BTCUSDT_UMCBL&granularity=300&startTime=1684893324&endTime=1684914924&limit=100
method: GET
body: 
headers: {'Content-Type': 'application/json', 'ACCESS-KEY': '*****', 'ACCESS-SIGN': *****', 'ACCESS-TIMESTAMP': '***', 'ACCESS-PASSPHRASE': '****'}
response :  []
status: 200
[]
@CadeHalcyon
Copy link

CadeHalcyon commented May 26, 2023

I see the same issue - no klines/candlestick data:

payload = {"symbol":"BTCUSDT_UMCBL",
           "granularity": '1H', 
           "startTime":start_time, 
           "endTime":end_time,
           "limit": 100}

r = requests.get("https://api.bitget.com/api/mix/v1/market/candles", params=payload)

print(r.status_code)
print(r.url)
print(r.text)

Output:

200
https://api.bitget.com/api/mix/v1/market/candles?symbol=BTCUSDT_UMCBL&granularity=1H&startTime=1684800000&endTime=1685102856&limit=100
[]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants