新しい言語のライブラリを作るとき、メソッドの作成規則はここに書かれているとおりにしよう!(提案)
APIdocの項目 | キャメルケース | スネークケース |
---|---|---|
GET /{pair}/ticker | getTicker | get_ticker |
GET /{pair}/depth | getDepth | get_depth |
GET /{pair}/transactions | getTransactions | get_transactions |
GET /{pair}/transactions/{YYYYMMDD} | getTransactions | get_transactions |
GET /{pair}/candlestick/{candle-type}/{YYYY} | getCandleStick | get_candle_stick |
GET /user/assets | getAssets | get_assets |
GET /user/spot/order | getOrderInfo | get_order_info |
POST /user/spot/order | sendOrder | send_order |
POST /user/spot/cancel_order | cancelOrder | cancel_order |
POST /user/spot/cancel_orders | cancelOrders | cancel_orders |
POST /user/spot/orders_info | getOrdersInfo | get_orders_info |
GET /user/spot/active_orders | getActiveOrders | get_active_orders |
GET /user/withdrawal_account | getWithdrawalAccount | get_withdrawal_account |
POST /user/request_withdrawal | requestWithdrawal | request_withdrawal |
- 情報取得系は全部"get〜"にする
POST /user/spot/orders_info
は情報取得系なので"get〜"にする- 引数の命名はドキュメントに記載されているパラメータに合わせる(キャメルケースで実装している言語ではキャメルケースに直す)
- ユーザが以下のようにクラスをインスタンス化することで利用できるように実装する
val bitbankcc = new Bitbankcc("API_KEY", "API_SECRET")
val ticker = bitbankcc.getTicker()
- nonce値をクラス内のインスタンス変数で管理し、メソッドが呼ばれるたびにインクリメントして管理する
- nonceの初期値はUNIXTIMEのミリ秒
- APIドキュメントにあるAPIはすべて実装しよう
- できればドキュメントに使い方を載せよう
- スネークケースを使うかキャメルケースを使うかどうかは、言語毎の空気を読んで使い分けるって感じで ✋