Git Product home page Git Product logo

bitflyer's Introduction

bitflyer

All Contributors

Gem Version Circle CI Code Climate Libraries.io dependency status for GitHub repo GitHub

bitflyer is a wrapper interface of Bitflyer lightning API

Installation

gem install bitflyer

Usage

See https://lightning.bitflyer.jp/docs for details.

HTTP API

See public.rb / private.rb for method definition.

Example

public_client = Bitflyer.http_public_client
p public_client.board # will print board snapshot
 
private_client = Bitflyer.http_private_client('YOUR_API_KEY', 'YOUR_API_SECRET')
p private_client.positions # will print your positions

Realtime API

Public events

Accessor format is like {event_name}_{product_code}. You can set lambda to get realtime events.

{event_name} and {product_code} is defined at client.rb.

Private events

To subscribe to the private child_order_events and parent_order_events, pass your API key and secret when creating the realtime_client.

Connection status monitoring

The ready callback is called when the realtime_client is ready to receive events (after the socket connection is established, the optional authentication has succeeded, and the channels have been subscribed). If connection is lost, the disconnected callback is called, and reconnection is attempted automatically. When connection is restored, ready is called again.

Examples

For public events only:

client = Bitflyer.realtime_client
client.ticker_btc_jpy = ->(json){ p json } # will print json object
client.executions_btc_jpy = ->(json){ p json }
# ...

For both public and private events:

client = Bitflyer.realtime_client('YOUR_API_KEY', 'YOUR_API_SECRET')
# Private events:
client.child_order_events = ->(json){ p json }
client.parent_order_events = ->(json){ p json }
# Public events:
client.ticker_btc_jpy = ->(json){ p json }
client.executions_btc_jpy = ->(json){ p json }
# ...

Connection monitoring:

client = Bitflyer.realtime_client
client.ready = -> { p "Client is ready to receive events" }
client.disconnected = ->(error) { p "Client got disconnected" }

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/unhappychoice/bitflyer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Yves-Eric Martin

๐Ÿ’ป

Yuji Ueki

๐Ÿ’ป

Shoma FUKUDA

๐Ÿ’ป

shidetake

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

bitflyer's People

Contributors

unhappychoice avatar dependabot[bot] avatar dependabot-preview[bot] avatar yemartin avatar allcontributors[bot] avatar fkshom avatar shidetake avatar

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.