파이썬/바이낸스 선물 API 8

[선물 API] 주문 넣기, 취소하기

API키를 발급 받은 상태여야 합니다.API키 발급 방법은 바이낸스 API키 발급 참조 1. 시장가 주문import ccxtimport timewith open("D:/코인/binance key.txt") as f: lines = f.readlines() api_key = lines[0].strip() secret_key = lines[1].strip()Futures_binance = ccxt.binance({ 'apiKey': api_key, 'secret': secret_key, 'enableRateLimit': True, 'options': { 'defaultType': 'future', 'adjustForTimeDifference': ..

[선물 API] 바이낸스 선물 레버리지 배율 변경

만약 안되면 사용중인 PC의 시간을 동기화 해줘야 합니다.윈도우 11 기준 화면 우측 하단에 표기된 시간을 우클릭 후 날짜 및 시간 조정을 누르신 다음 '지금 동기화'를 누르시면 됩니다.import requestsimport hmacimport hashlibimport timefrom binance.client import Clientfrom pprint import pprint# 바이낸스 API 키와 시크릿 로드with open("D:/코인/binance key.txt") as f: lines = f.readlines() api_key = lines[0].strip() secret_key = lines[1].strip()client = Client(api_key, secret_key)h..

[선물API] 계좌 정보 불러오기

먼저 API키가 필요합니다.바이낸스 API키 발급 방법->  바이낸스 API키 발급  만약 안되면 사용중인 PC의 시간을 동기화 해줘야 합니다.윈도우 11 기준 화면 우측 하단에 표기된 시간을 우클릭 후 날짜 및 시간 조정을 누르신 다음 '지금 동기화'를 누르시면 됩니다.import requestsimport hmacimport hashlibimport timefrom pprint import pprint# 바이낸스 API 키와 시크릿 로드with open("D:/코인/binance key.txt") as f: lines = f.readlines() api_key = lines[0].strip() secret_key = lines[1].strip()headers = { "X-MBX-..

[선물 API] 여러개 주문 동시에 넣기

해당 코드는 과거에 사용하고 최근에 개선하지 않은 코드입니다.제대로 작동하지 않을 수 있습니다. import ccxtimport asyncioimport logging# API, Secret Key가 저장된 txt 파일을 불러오는 코드. 경로는 바꿔도 상관없다.with open("D:/코인/binance key.txt") as f: lines = f.readlines() api_key = lines[0].strip() secret_key = lines[1].strip()logger = logging.getLogger('ccxt')logger.setLevel(logging.ERROR)Futures_binance = ccxt.binance({ 'apiKey': api_key, 's..

[선물 API] 차트 데이터 불러오기

차트를 가져오는 방법은 크게 두가지가 있습니다.CCXT라는 가상화폐 거래소의 API를 단일한 인터페이스로 제공하는 오픈소스 라이브러리를 활용하는 것.바이낸스에서 제공되는 API를 직접 요청하는 것.  우선 CCXT를 활용하는 방법입니다.import ccxtimport pprintFutures_binance = ccxt.binance(config={ 'options': { 'defaultType': 'future' }})BTC_Chart = Futures_binance.fetch_ohlcv( symbol="BTCUSDT", timeframe='1m', limit=20)pprint.pprint(BTC_Chart) CCXT를 통해 받은 차트 데이터는 리스트 형태입니다.[..

반응형