본문 바로가기
트레이딩/암호화폐

암호화폐. API. bybit. 나의 주문 정보 실시간 받기. websocket

by i.got.it 2020. 12. 19.

개요 

거래소 바이빗의 USD 종목, USDT 종목 내가 주문 송신한것에 의한 WebSocket 으로 실시간 수신되는 주문응답. 

 

 

 

 

사전준비 

- 파이썬 웹소켓 기본 코딩 달성하고 인증 코딩 까지 달성한 상태. 

 

 

 

 

USD 종목에서의 주문 실시간 정보 

order 실시간 정보 요청 구문. 

websocket.send('{"op": "subscribe", "args": ["order"]}')

 

상기 요청 한번만 요청하면 이후 상황 변동 되면 아래와 같은 정보요소들이 json 형식으로 실시간 수신됨. 

Response Parameters

parameter type comments
order_id string Order ID
order_link_id string Order link ID
symbol string Symbol
side string Side
order_type string Conditional order type
price string Order price
qty number Transaction qty
time_in_force string Time in force
create_type string Trigger scenario for single action
cancel_type string Trigger scenario for cancel operation
order_status string Order status
leaves_qty number Number of unfilled contracts from the order's size
cum_exec_qty number Cumulative qty of trading
cum_exec_value string Cumulative value of trading
cum_exec_fee string Cumulative trading fees
timestamp string Commission time
take_profit string Take profit price
stop_loss string Stop loss price
trailing_stop string Trailing stop
trailing_active string Trailing stop active price
last_exec_price string Last execution price

 

{
    "topic": "order",
    "data": [
        {
            "order_id": "xxxxxxxx-xxxx-xxxx-9a8f-4a973eb5c418",
            "order_link_id": "",
            "symbol": "BTCUSD",
            "side": "Sell",
            "order_type": "Market",
            "price": "8579.5",
            "qty": 1,
            "time_in_force": "ImmediateOrCancel",
            "create_type": "CreateByClosing",
            "cancel_type": "",
            "order_status": "Filled",
            "leaves_qty": 0,
            "cum_exec_qty": 1,
            "cum_exec_value": "0.00011655",
            "cum_exec_fee": "0.00000009",
            "timestamp": "2020-01-14T14:09:31.778Z",
            "take_profit": "0",
            "stop_loss": "0",
            "trailing_stop": "0",
            "last_exec_price": "8300"
        }
    ]
}

 

order_status

  • Created - order accepted by the system but not yet put through matching engine
  • Rejected ; 주문거부
  • New : order has placed successfully
  • PartiallyFilled
  • Filled
  • Cancelled
  • PendingCancel - the matching engine has received the cancellation but there is no guarantee that it will be successful

 

order_status : "Filled" , PartiallyFilled

- PartiallyFilled : 주문수량의 일부만 체결된 경우. 체결 수량은 cum_exec_qty, 체결가 는 last_exec_price  로 최종 체결가 만 제공됨. 

- Filled : 주문 수량 전량 체결된 경우. 체결 수량은 cum_exec_qty, 체결가 는 last_exec_price  로 최종 체결가만 제공됨. 

 

 

create_type

  • CreateByUser
  • CreateByClosing
  • CreateByAdminClosing
  • CreateByStopOrder
  • CreateByTakeProfit
  • CreateByStopLoss
  • CreateByTrailingStop
  • CreateByLiq - Created by partial liquidation
  • CreateByAdl_PassThrough - Created by ADL
  • CreateByTakeOver_PassThrough - Created by liquidation takeover

 

 

 

 

 

수신 데이터 예 

시장가 주문예

- 사용자가 웹에서 시장가 주문한 경우임. 

- symbol : EOSUSD ,

- side : Buy , Sell

- last_exec_price : 3.097 , 3.096 

- qty : 1  (단위 USD)

- order_type : Market ,

- order_status : Filled. ( 주문수량 qty 전량 체결)

- cum_exec_qty : 1 (단위 USD. 주문수량 qty  1과 비교하여 전량 체결여부 확인가능) 

- cum_exec_value : 0.32289312 , 0.32299741 (단위 EOS) 

- cum_exec_fee : 0.00024217 , 0.00024225 (단위 EOS, 수수료 0.075% 에 해당하는 금액임)

- create_type : CreateByUser  

주의 : create_type CreateByUser 의미는 "사용자가 이 주문을 생성했다"의 의미만 있으며 이 주문이 신규 포지션 증가 목적인지 혹은 주문창에서 Reduce-Only 선택하여 기존 포지션 청산 목적의 주문한 것인지 식별수단이 order 이벤트 정보 요소 중에는 없음. 

 

 

 

지정가 주문예

- 사용자가 웹에서 지정가 주문한 경우임. 

 

- symbol : EOSUSD ,

- side :  Sell , Buy

- price : 3.4 , 2.6 

- qty : 3  (단위 USD)

- order_type : Limit ,

- order_status : New  (의미 : 거래소 접수 성공했고 유효한 주문 )

- cum_exec_qty : 0 (단위 USD. ) 

- cum_exec_value : 0  (단위 EOS) 

- cum_exec_fee : 0 (단위 EOS)

- create_type : CreateByUser  

주의 :  실시간 주문정보에는 이 주문이 포지션 청산 목적(Reduce-Only) 주문 인지 정보 제공안되며, 웹에서 Reduce-Only 체크하고 주문해도 수신되는 정보에는 이 주문이 Reduce-Only 주문 여부 정보 제공안됨. 

 

 

취소주문예

- 사용자가 웹에서 지정가 주문을 취소한 경우임. 

 

- order_id : 취소대상 주문의 아이디와 동일함. 즉, 취소주문 자체의 order_id 는 발급되지 않음.

- symbol : EOSUSD ,

- side :  Sell , Buy

- price : 3.4 , 2.6  (취소대상 주문의 가격)

- qty : 3  (단위 USD)

- order_type : Limit ,

- order_status : Cancelled  (의미 : 거래소에서 취소 성공했고 대상 지정가 주문 제거되었음 )

- cancel_type : CancelByUser

- create_type : CreateByUser  

 

 

숏포지션 2usd 를 사용자가 웹에서 시장가 청산 주문 클릭한 경우 수신데이터.

 

- symbol : EOSUSD , 

- side : Buy ,

- last_exec_price : 2.63 

- qty : 2 (단위 USD)

- order_type : Market ,

- order_status : Filled. ( 주문수량 qty 전량 체결)

- cum_exec_qty : 2 (단위 USD. 주문수량 qty  2와 비교하여 전량 체결여부 확인가능) 

- cum_exec_value : 0.76045627 (단위 EOS) 

- cum_exec_fee : 0.00057035 (단위 EOS, 수수료 0.075% 에 해당하는 금액임)

- create_type : CreateByClosing  에서 이 주문은 포지션 청산 주문임을 식별가능.

 

 

 

 

 

 

USDT 종목 에서의 주문 실시간 정보 

 

order 실시간 정보 요청 구문. 

 

ws.send('{"op": "subscribe", "args": ["order"]}')

 

상기 요청 한번만 요청하면 이후 상황 변동 되면 아래와 같은 json 형식의 데이터 실시간 수신됨. 

 

Response Parameters

 

parameter type comments
order_id string Order ID
order_link_id string Order link ID
symbol string Symbol
side string Side
order_type string Conditional order type
price string Order price
qty number Transaction qty
time_in_force string Time in force
order_status string Order status
last_exec_price number Last execution price
cum_exec_qty number Cumulative qty of trading
cum_exec_value string Cumulative value of trading
cum_exec_fee string Cumulative trading fees
create_time string Commission time
update_time string Update time

 

{
    "topic": "order",
    "action": "",
    "data": [
        {
            "order_id": "xxxxxxxx-xxxx-xxxx-9a8f-4a973eb5c418",
            "order_link_id": "",
            "symbol": "BTCUSDT",
            "side": "Buy",
            "order_type": "Limit",
            "price": 11000,
            "qty": 0.001,
            "leaves_qty": 0.001,
            "last_exec_price": 0,
            "cum_exec_qty": 0,
            "cum_exec_value": 0,
            "cum_exec_fee": 0,
            "time_in_force": "GoodTillCancel",
            "create_type": "CreateByUser",
            "cancel_type": "UNKNOWN",
            "order_status": "New",
            "take_profit": 0,
            "stop_loss": 0,
            "trailing_stop": 0,
            "create_time": "2020-08-12T21:18:40.780039678Z",
            "update_time": "2020-08-12T21:18:40.787986415Z"
        }
    ]
}

 

 

 

연관 

 

http request 로 주문정보 받기.

 

암호화폐. API. bybit. 나의 주문 정보 받기. http request

개요 바이빗의 USD 종목 , USDT종목의 내 주문정보 HTTP Request 하여 받기. USD 종목 의 주문정보 받기 HTTP Request GET /v2/private/order Request Parameters parameter required type comments order_id fals..

igotit.tistory.com

 

 

암호화폐. API. 바이빗. REST , WebSocket

bybit API 개요 - 형식 : REST , WebSocket - bybit 거래소 가입 하여 API 키 발급 받아야 API 적용된 클라이언트 앱에서 활용가능. - 개발가능한 언어 : REST, WebSocket 구현가능한 모든 언어 - C++, 자바스크립..

igotit.tistory.com

 

 

거래소. bybit. 바이빗. 개요. 가입방법. 암호화폐

바이빗 거래소 주요특징. - 거래가능 종목 : - BTCUSD , ETHUSD , EOSUSD , XRPUSD - 최대 레버리지 100 까지 가능 매매자가 레버리지 사용 유무 선택가능. 바이빗 레버리지 상세   - - 장점 : 레버리지 1에서

igotit.tistory.com

 

 

 

 


첫 등록 : 2020.03.17

최종 수정 : 2020.12.19

단축 주소 : https://igotit.tistory.com/2488

 


 

 

 

 

댓글



 

비트코인




암호화폐       외환/나스닥/골드       암호화폐/외환/나스닥/골드 암호화폐/외환/나스닥/골드   암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)     롤오버 이자 없는 스왑프리계좌
( 스왑프리 암호화폐도 거래 가능 )    
MT4, MT5 , cTrader 모두 지원     FTMO 계좌 매매운용. MT4,MT5