{"id":19978887,"url":"https://github.com/larrylv/dealer","last_synced_at":"2025-08-02T03:33:46.724Z","repository":{"id":57488830,"uuid":"47980113","full_name":"larrylv/dealer","owner":"larrylv","description":"Elixir api library for Stockfighter","archived":false,"fork":false,"pushed_at":"2015-12-25T14:33:50.000Z","size":55,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-29T21:47:21.325Z","etag":null,"topics":["elixir","stockfighter"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/larrylv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-14T14:32:55.000Z","updated_at":"2020-08-28T04:01:09.000Z","dependencies_parsed_at":"2022-08-29T10:30:18.569Z","dependency_job_id":null,"html_url":"https://github.com/larrylv/dealer","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/larrylv/dealer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrylv%2Fdealer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrylv%2Fdealer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrylv%2Fdealer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrylv%2Fdealer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/larrylv","download_url":"https://codeload.github.com/larrylv/dealer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrylv%2Fdealer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268331001,"owners_count":24233158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","stockfighter"],"created_at":"2024-11-13T03:35:43.135Z","updated_at":"2025-08-02T03:33:46.686Z","avatar_url":"https://github.com/larrylv.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dealer\n\nAn api library for [Stockfighter](https://www.stockfighter.io/) in Elixir, providing functions to interact with the Stock as well as the GM apis.\n\n[![Build Status](https://img.shields.io/travis/larrylv/dealer.svg)](https://travis-ci.org/larrylv/dealer)\n[![Hex.pm Version](https://img.shields.io/hexpm/v/dealer.svg?style=flat-square)](https://hex.pm/packages/dealer)\n[![Docs](https://inch-ci.org/github/larrylv/dealer.svg?branch=master\u0026style=flat-square)](https://inch-ci.org/github/larrylv/dealer)\n[![Hex.pm Downloads](https://img.shields.io/hexpm/dt/dealer.svg?style=flat-square)](https://hex.pm/packages/dealer)\n\n## Installation\n\n  1. Add dealer to your list of dependencies in `mix.exs`:\n\n        def deps do\n          [{:dealer, \"~\u003e 0.8.0\"}]\n        end\n\n  2. Ensure dealer is started before your application:\n\n        def application do\n          [applications: [:dealer]]\n        end\n\n## Usage\n\n### Start application\n\nIf you havn't specified starting `dealer` application in your mix.exs, or you are in a normal `iex` session, you should explicitly call `Dealer.start` to start the application.\n\n### Authentication\n\nYou should set `DEALER_API_KEY` environment variable, or set the application env by `Application.put_env(:dealer, :api_key, \"your_api_key\")`.\n\n### Response\n\nIf the api request is successful, the response will be a `Dealer.Response` struct, which is a struct defined containing three fields:\n\n* data: decoded json response\n* status_code: the request's status code\n* raw_response: original response\n\nOr something bad might happen during the reuqest, the response will be: `{:error, term}`.\n\nWebsocket response will be either a `Dealer.Websocket.Response` struct or `{:error, term}`.\n\n## API Documentation\n\n### Check The Api Is Up\n\nDocumentation link: https://starfighter.readme.io/docs/heartbeat\n\n``` elixir\niex\u003e Dealer.Heartbeat.get\n```\n\n### Check The Venue Is Up\n\nDocumentation link: https://starfighter.readme.io/docs/venue-healthcheck\n\n``` elixir\niex\u003e Dealer.Venue.heartbeat(\"RQOVEX\")\n```\n\n### Stocks on a Venue\n\nDocumentation link: https://starfighter.readme.io/docs/list-stocks-on-venue\n\n``` elixir\niex\u003e Dealer.Stocks.on_venue(\"RQOVEX\")\n```\n\n### The Orderbook For A Stock\n\nDocumentation link: https://starfighter.readme.io/docs/get-orderbook-for-stock\n\n``` elixir\niex\u003e Dealer.Stock.orderbook(\"RQOVEX\", \"DIUW\")\n```\n\n### A New Order For A Stock\n\nDocumentation link: https://starfighter.readme.io/docs/place-new-order\n\n``` elixir\niex\u003e Dealer.Orders.create(\"QWYIEX\", \"YPII\", %{account: \"TOB1728377\", price: 33, qty: 100, direction: \"buy\", orderType: \"limit\"})\n```\n\n### A Quote For A Stock\n\nDocumentation link: https://starfighter.readme.io/docs/a-quote-for-a-stock\n\n``` elixir\niex\u003e Dealer.Stock.quote(\"LBPTEX\", \"GVOE\")\n```\n\n### Status For An Existing Order\n\nDocumentaion link: https://starfighter.readme.io/docs/status-for-an-existing-order\n\n``` elixir\niex\u003e Dealer.Order.status(\"LBPTEX\", \"GVOE\", 306)\n```\n\n### Cancel An Order\n\nDocumentation link: https://starfighter.readme.io/docs/cancel-an-order\n\n``` elixir\niex\u003e Dealer.Order.cancel(\"LBPTEX\", \"GVOE\", 306)\n\n```\n\n### Status For All Orders\n\nDocumentation link: https://starfighter.readme.io/docs/status-for-all-orders\n\n``` elixir\niex\u003e Dealer.Orders.status(\"LBPTEX\", \"ACCOUNT_NAME\")\n```\n\n### Status For All Orders In A Stock\n\nDocumentation link: https://starfighter.readme.io/docs/status-for-all-orders-in-a-stock\n\n``` elixir\niex\u003e Dealer.Orders.status(\"LBPTEX\", \"ACCOUNT_NAME\", \"GVOE\")\n```\n\n## Websocket Documentation\n\n### Quotes (Ticket Tape)\n\nDocumentation link: https://starfighter.readme.io/docs/quotes-ticker-tape-websocket\n\n``` elixir\niex\u003e {account, venue, stock} = {\"MSB5372858\", \"TYAMEX\", \"PTC\"}\niex\u003e socket = Dealer.Websocket.Quotes.connect!(account, venue)\niex\u003e Dealer.Websocket.Quotes.recv!(socket)\niex\u003e Dealer.Websocket.Quotes.close(socket)\n\niex\u003e socket = Dealer.Websocket.Quotes.connect!(account, venue, stock)\niex\u003e Dealer.Websocket.Quotes.recv!(socket)\niex\u003e Dealer.Websocket.Quotes.close(socket)\n```\n\n### Executions (Fills)\n\nDocumentation link: https://starfighter.readme.io/docs/executions-fills-websocket\n\n``` elixir\niex\u003e {account, venue, stock} = {\"MSB5372858\", \"TYAMEX\", \"PTC\"}\niex\u003e socket = Dealer.Websocket.Executions.connect!(account, venue)\niex\u003e Dealer.Websocket.Executions.recv!(socket)\niex\u003e Dealer.Websocket.Executions.close(socket)\n\niex\u003e socket = Dealer.Websocket.Executions.connect!(account, venue, stock)\niex\u003e Dealer.Websocket.Executions.recv!(socket)\niex\u003e Dealer.Websocket.Executions.close(socket)\n```\n\n## GM Documentation\n\n### Start a level\n\n``` elixir\niex\u003e Dealer.GM.start_level(\"dueling_bulldozers\")\n```\n\n### Get an instance state\n\n``` elixir\niex\u003e Dealer.GM.get_instance(5360)\n```\n\n### Stop an instance\n\n``` elixir\niex\u003e Dealer.GM.stop_instance(5360)\n```\n\n### Restart an instance\n\n``` elixir\niex\u003e Dealer.GM.restart_instance(5360)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarrylv%2Fdealer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flarrylv%2Fdealer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarrylv%2Fdealer/lists"}