Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
bybit 에서 발급받은 본인 api key 기록
bybit 에서 발급받은 본인 secrete key 기록.
https://api.bybit.com
wss://stream.bybit.com/realtime
wss://stream.bybit.com/realtime_public
wss://stream.bybit.com/realtime_private
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
기록방법. -6줄. 파일명 : apikey_url_bybit.txt
1 : api key . bybit에서 발급받은 본인 api key
2 : secret key . bybit 에 발급받은 본인 secret key
3 : bybit REST 주소. USD, USDT 용. 실거래소 https://api.bybit.com , 데모주소 https://api-testnet.bybit.com
4 : bybit 웹소켓 주소.USD용. 실거래소 wss://stream.bybit.com/realtime , 데모주소 wss://stream-testnet.bybit.com/realtime
5 : bybit 웹소켓 주소 USDTpublic. 실거래소 wss://stream.bybit.com/realtime_public , 데모주소 wss://stream-testnet.bybit.com/realtime_public
6 : bybit 웹소켓 주소 USDTprivate. 실거래소 wss://stream.bybit.com/realtime_private , 데모주소 wss://stream-testnet.bybit.com/realtime_private
위의 내용을 기록한 apikey_url_bybit.txt 로 저장. 경로 파이썬 파일이 있는 동일 폴더.
##### 상기 파일 읽는 파이썬 코드.
with open('apikey_url_bybit.txt', encoding='utf8') as f:
count_line=0
for line in f:
count_line+=1
if count_line == 1: # bybit API key
api_key = line.rstrip('\n')
elif count_line == 2: # bybit secret key
api_secret = line.rstrip('\n')
elif count_line == 3: # bybit REST url for both Inverse Perpetual and USDT Perpetual,
url_rest_bybit = line.rstrip('\n')
elif count_line == 4: # bybit websocket url for Inverse Perpetual, BTCUSD , etc
url_ws_inverse_bybit = line.rstrip('\n')
elif count_line == 5: # bybit websocket public url for USDT Perpetual, BTCUSDT, etc
url_ws_usdt_public_bybit = line.rstrip('\n')
elif count_line == 6: # bybit websocket private url for USDT Perpetual, BTCUSDT, etc
url_ws_usdt_private_bybit = line.rstrip('\n')
break;
print('OK : read file apikey_url_bybit.txt')
@igotit-anything
Copy link
Author

igotit-anything commented Oct 31, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment