Giter Site home page Giter Site logo

stockastic's Introduction

Stockastic

Simple Elixir wrapper for the Stockfighter API.

Documentation can be found here

Quickstart

First, add Stockastic to your mix.exs dependencies:

def deps do
  [{:stockastic, "~> 0.0.2"}]
end

Fetching dependencies and running on elixir console:

mix deps.get
iex -S mix

You will see something like this:

Erlang/OTP 18 [erts-7.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Interactive Elixir (1.1.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Stockastic.start

Examples

Instantiating an authenticated client:

iex(1)> client = Stockastic.Client.new(%{access_token: "API_TOKEN_HERE"})
%Stockastic.Client{auth: %{access_token: "API_TOKEN_HERE"},
 endpoint: "https://api.stockfighter.io/ob/api/"}

List stocks for a venue:

iex(2)> Stockastic.Stocks.list("EMWEX", client)                                                    
%{"ok" => true,
  "symbols" => [%{"name" => "IdeaMountain Ltd.", "symbol" => "IML"}]}

Listing orders for a stock, on a venue:

iex(3)> Stockastic.Orders.list_for_stock("EMWEX", "YS53802698", "IML", client)                     
%{"ok" => true, "orders" => []}

Fetching the orderbook for a stock, on a venue:

iex(4)> Stockastic.Stocks.orderbook("EMWEX", "IML", client)                                        
%{"asks" => nil,
  "bids" => [%{"isBuy" => true, "price" => 6019, "qty" => 176},
   %{"isBuy" => true, "price" => 5765, "qty" => 1691},
   %{"isBuy" => true, "price" => 5737, "qty" => 1691},
   %{"isBuy" => true, "price" => 5709, "qty" => 1691}], "ok" => true,
  "symbol" => "IML", "ts" => "2015-12-11T20:25:06.068350021Z",
  "venue" => "EMWEX"}

Further documentation is available here.

Contributing

Start by forking this repo

Then run this command to fetch dependencies and run tests:

MIX_ENV=test mix do deps.get, test

Pull requests are greatly appreciated

stockastic's People

Contributors

quinnwilton avatar

Watchers

James Sanders avatar James Cloos 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.