client_id · client_secret 을 발급받으세요.curl -X POST https://이 주소/oauth/token \
-H 'Content-Type: application/json' \
-d '{"grant_type":"client_credentials","client_id":"mc_…","client_secret":"ms_…"}'
→ {"access_token":"…","token_type":"Bearer","expires_in":3600}
토큰은 1시간 동안 씁니다. 만료되면(401) 다시 받습니다.
curl https://이 주소/v1/models -H 'Authorization: Bearer <access_token>'
curl -X POST https://이 주소/v1/models/candlegpt/predict \
-H 'Authorization: Bearer <access_token>' -H 'Content-Type: application/json' \
-d '{"market":"KRW-XRP","paths":100}'
| 응답 항목 | 뜻 |
|---|---|
direction | 5m·15m·30m·60m 뒤 지금 종가보다 오를(up)·내릴(down)·그대로(flat) 확률 |
range_1h | 다음 1시간 고가·저가가 지금 종가 대비 몇 % 인지 (q10·q50·q90) |
candles_median | 다음 12봉(5분×12) 예측 캔들 — 경로 n개의 가운데 값, 호가 단위 |
close_band | 봉마다 종가 80% 범위 (q10·q90) |
history | 지난 48봉(실제) |
now_utc · last_close | '지금' 봉(완성된 마지막 5분 봉)과 그 종가 |
시세를 직접 넘길 수도 있습니다(서버는 외부 호출 없음): {"market":"KRW-XRP","now_utc":"…Z","candles":[[ts,open,high,low,close,value],…],"btc":[…]} — 빈 봉 없는 업비트 5분봉 최근 800개 이상.
버전 지정: ?version=1. 없으면 기본 버전.
| 코드 | 뜻 |
|---|---|
| 400 | 요청 형식이 틀림 (오류 문구에 이유) |
| 401 | 토큰 없음·만료·틀림 → 토큰 다시 받기 |
| 403 | 중지된 클라이언트이거나 그 모델 권한이 없음 |
| 429 | 분당 호출 수 초과 |
| 503 | 그 모델 버전이 자기 검사를 통과하지 못해 막힘 |
import requests, time
BASE, CID, SEC = 'https://이 주소', 'mc_…', 'ms_…'
_tok = {'t': None, 'exp': 0}
def token():
if time.time() > _tok['exp'] - 60:
j = requests.post(f'{BASE}/oauth/token', json={'grant_type': 'client_credentials', 'client_id': CID, 'client_secret': SEC}, timeout=10).json()
_tok.update(t=j['access_token'], exp=time.time() + j['expires_in'])
return _tok['t']
r = requests.post(f'{BASE}/v1/models/candlegpt/predict', json={'market': 'KRW-BTC'},
headers={'Authorization': f'Bearer {token()}'}, timeout=30).json()
print(r['direction']['60m'])