Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What is going on with this article?
@ta1nakamura

swagger-clientでBitMEXトレードしたい

More than 1 year has passed since last update.

Swagger概要

  • REST APIの標準。デファクトスタンダード(だった?)
  • APIの定義を書くとドキュメントとインターフェース部のソースが自動生成される
  • いろいろあって、2018年フォークした

Node.jsでのチュートリアル(document, api)

クライアント swagger-client

swagger-client、メソッドの一覧

参考:メソッド一覧(一部異なる)
https://github.com/BitMEX/api-connectors/tree/master/auto-generated/javascript

利用方法のサンプル
https://github.com/BitMEX/api-connectors/blob/master/official-http/node-swagger/swaggerClient.js

inspect(client.apis)でメソッド一覧を出力

swaggerClient.js
new SwaggerClient({
  // Switch this to `www.bitmex.com` when you're ready to try it out for real.
  // Don't forget the `www`!
  url: 'https://testnet.bitmex.com/api/explorer/swagger.json',
  usePromise: true
})
.then(function(client) {
  // Comment out if you're not requesting any user data.
  client.clientAuthorizations.add("apiKey", new BitMEXAPIKeyAuthorization('api-key', 'api-secret'));

  // Print client capabilities
  inspect(client.apis); // ← メソッド一覧を出力

出力結果を整形した
引数・戻り値等の詳細はswaggerドキュメント参照
https://www.bitmex.com/api/explorer/

Inspecting BitMEX API...
 [Announcement] :
    Announcement_get, Announcement_getUrgent
 [APIKey] :
    APIKey_remove, APIKey_get, APIKey_new, APIKey_disable, APIKey_enable
 [Chat] :
    Chat_get, Chat_new, Chat_getChannels, Chat_getConnected
 [Execution] :
    Execution_get, Execution_getTradeHistory
 [Funding] :
    Funding_get
 [Instrument] :
    Instrument_get, Instrument_getActive, Instrument_getIndices, Instrument_getActiveAndIndices, 
    Instrument_getActiveIntervals, Instrument_getCompositeIndex
 [Insurance] :
    Insurance_get
 [Leaderboard] :
    Leaderboard_get, Leaderboard_getName
 [Liquidation] :
    Liquidation_get
 [GlobalNotification] :
    GlobalNotification_get
 [Order] :
    Order_cancel, Order_getOrders, Order_new, Order_amend, Order_newBulk, Order_amendBulk, 
    Order_closePosition, Order_cancelAll, Order_cancelAllAfter
 [OrderBook] :
    OrderBook_getL2
 [Position] :
    Position_get, Position_isolateMargin, Position_updateRiskLimit, Position_transferIsolatedMargin, 
    Position_updateLeverage
 [Quote] :
    Quote_get, Quote_getBucketed
 [Schema] :
    Schema_get, Schema_websocketHelp
 [Settlement] :
    Settlement_get
 [Stats] :
    Stats_get, Stats_history, Stats_historyUSD
 [Trade] :
    Trade_get, Trade_getBucketed
 [User] :
    User_getDepositAddress, User_getWallet, User_getWalletHistory, User_getWalletSummary, 
    User_getExecutionHistory, User_minWithdrawalFee, User_requestWithdrawal, User_cancelWithdrawal, 
    User_confirmWithdrawal, User_requestEnableTFA, User_confirmEnableTFA, User_disableTFA, User_confirm, 
    User_getAffiliateStatus, User_checkReferralCode, User_logout, User_logoutAll, User_savePreferences, 
    User_get, User_update, User_getCommission, User_getMargin, User_communicationToken
 [UserEvent] :
    UserEvent_get   
------------------------
1
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
1
Help us understand the problem. What is going on with this article?