Code Monkey home page Code Monkey logo

coincheck_dummy_api's Introduction

ダミーcoincheck API(非公式)

coincheck APIを使った自動売買を行うため、ざっと作りました。 実際の取引システムの中身を知っているわけではないので、約定部分とか結構甘いと思うけど、、、おいおい直していきます。

対応したAPI

仕様は本家に準じているつもり

Public API

ティッカー

GET /api/ticker

全取引履歴

GET /api/trades

板情報

GET /api/order_books

販売レート取得

GET /api/rate/[pair]

※対応しているのは[pair] = btc_jpyのみ

Private API

新規注文

POST /api/exchange/orders

※「レバレッジ取引新規」と「決済」しか対応していません。

ポジション一覧

GET /api/exchange/leverage/positions

レバレッジアカウントの残高

GET /api/accounts/leverage_balance


上記のダミーAPIとは別にテストの為のデータ設定用APIがあります。

トレードデータのセーブ

GET /api/save_seed

パラメータ
stop_time 終了時間
未記入の場合は現在から1分間

interval_time 取得間隔(秒)
未記入の場合は10秒

例:http://localhost:3000/api/save_seed?stop_time=2017/05/09/00:45

本APIの実行により、ticker、trades、order_books、btc_jpy_rateのseedファイルが生成させるので、終了後、 rails db:seedを実行してseedデータを作ってください。 ここ、多分coincheckのシステムに負荷かかってるから、オフィシャルのバックテスト環境が欲しいところ。。。

セーブ状態確認

GET /api/check_saving_status

セーブ済みトレードデータの開始終了の確認

GET /api/check_saved_seed_time_range

テスト用レバレッジアカウントの残高の設定

PUT /api/set_user_leverage_balance

パラメータ
margin テスト用の証拠金(jpy)

例:http://localhost:3000/api/set_user_leverage_balance? margin=100000

テスト開始終了データをUserに設定

PUT /api/set_test_trade_time

テストの終了判定

GET /api/check_test_trade_is_over

テストデータ読み込み時間の更新

PUT /api/update_start_trade_time

パラメータ
interval_time 経過時間(秒)

※本APIを実行することでテスト用のpublic APIを実行した時、次のデータを取得できるようになります。

例:http://localhost:3000/api/update_start_trade_time? interval_time=5

これを実行することで、
http://localhost:3000/api/ticker
の取得結果が5秒後のデータになる。

coincheck_dummy_api's People

Contributors

xiao1203 avatar

Stargazers

 avatar Taka avatar es335ab avatar kenichi.shibata avatar zlq4863947 avatar y_ysk avatar Satoshi KURAMOCHI avatar  avatar

Watchers

 avatar

coincheck_dummy_api's Issues

温まってない問題?

NoMethodError - undefined method `>' for nil:NilClass:
  app/models/user.rb:30:in `test_trade_is_over?'
  app/controllers/api_controller.rb:384:in `check_test_trade_is_over'
  actionpack (5.1.0) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
  actionpack (5.1.0) lib/abstract_controller/base.rb:186:in `process_action'
  actionpack (5.1.0) lib/action_controller/metal/rendering.rb:30:in `process_action'
  actionpack (5.1.0) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
  activesupport (5.1.0) lib/active_support/callbacks.rb:131:in `run_callbacks'
  actionpack (5.1.0) lib/abstract_controller/callbacks.rb:19:in `process_action'
  actionpack (5.1.0) lib/action_controller/metal/rescue.rb:20:in `process_action'
  actionpack (5.1.0) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
  activesupport (5.1.0) lib/active_support/notifications.rb:166:in `block in instrument'
  activesupport (5.1.0) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
  activesupport (5.1.0) lib/active_support/notifications.rb:166:in `instrument'
  actionpack (5.1.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (5.1.0) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
  activerecord (5.1.0) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
  actionpack (5.1.0) lib/abstract_controller/base.rb:124:in `process'
  actionpack (5.1.0) lib/action_controller/metal.rb:189:in `dispatch'
  actionpack (5.1.0) lib/action_controller/metal.rb:253:in `dispatch'
  actionpack (5.1.0) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
  actionpack (5.1.0) lib/action_dispatch/routing/route_set.rb:31:in `serve'
  actionpack (5.1.0) lib/action_dispatch/journey/router.rb:46:in `block in serve'
  actionpack (5.1.0) lib/action_dispatch/journey/router.rb:33:in `serve'
  actionpack (5.1.0) lib/action_dispatch/routing/route_set.rb:832:in `call'
  rack (2.0.1) lib/rack/etag.rb:25:in `call'
  rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
  rack (2.0.1) lib/rack/head.rb:12:in `call'
  activerecord (5.1.0) lib/active_record/migration.rb:556:in `call'
  actionpack (5.1.0) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
  activesupport (5.1.0) lib/active_support/callbacks.rb:97:in `run_callbacks'
  actionpack (5.1.0) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
  actionpack (5.1.0) lib/action_dispatch/middleware/executor.rb:12:in `call'
  better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
  better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
  better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
  actionpack (5.1.0) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
  actionpack (5.1.0) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
  railties (5.1.0) lib/rails/rack/logger.rb:36:in `call_app'
  railties (5.1.0) lib/rails/rack/logger.rb:24:in `block in call'
  activesupport (5.1.0) lib/active_support/tagged_logging.rb:69:in `block in tagged'
  activesupport (5.1.0) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (5.1.0) lib/active_support/tagged_logging.rb:69:in `tagged'
  railties (5.1.0) lib/rails/rack/logger.rb:24:in `call'
  actionpack (5.1.0) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
  actionpack (5.1.0) lib/action_dispatch/middleware/request_id.rb:25:in `call'
  rack (2.0.1) lib/rack/runtime.rb:22:in `call'
  activesupport (5.1.0) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
  actionpack (5.1.0) lib/action_dispatch/middleware/executor.rb:12:in `call'
  actionpack (5.1.0) lib/action_dispatch/middleware/static.rb:125:in `call'
  rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
  railties (5.1.0) lib/rails/engine.rb:522:in `call'
  puma (3.8.2) lib/puma/configuration.rb:224:in `call'
  puma (3.8.2) lib/puma/server.rb:600:in `handle_request'
  puma (3.8.2) lib/puma/server.rb:435:in `process_client'
  puma (3.8.2) lib/puma/server.rb:299:in `block in run'
  puma (3.8.2) lib/puma/thread_pool.rb:120:in `block in spawn_thread'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.