stock_fighter 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3aec0e9fae963679c7a6dc7d578c71a8266bbd0a
4
- data.tar.gz: fdecba1ef331c5ed7fa538f34e840bbfa1bd62cb
3
+ metadata.gz: 1772c0c095e420f7c9248a2ff8d21fa7a1bda054
4
+ data.tar.gz: ace3c4c4def2ebb9374fc2cb06696168f0243a98
5
5
  SHA512:
6
- metadata.gz: 498eff0bd4d0664dc2d097253b67f7a71fafeee59c46b163ec8c3c7a1f3c7a26c8cc4e9ca0a648685970bfb9936b70c752dfbdc7a79c1dbf887f4c5c2365ed05
7
- data.tar.gz: a097f519b34b8cd8aab02eeb4151ed2cdba39855fc1bf63f1bc608a03cbcdd68d8d7c3d0725e547b3a609c8303d64ec152e389c309c44fbee51de1cb2abdc938
6
+ metadata.gz: 7d222076e658d09f0322e5cf01eafb8c158a16cd831368d3363220ff9dd68c0bdbd02dde78ac5eda70c8a4fb98367a6d3e1e43dd31c46f7d5a2d297857b85660
7
+ data.tar.gz: 5f86da62fcbfd4685272391f74ff4284e1692cc34bd9549ba925e468efb38bfad0509f600269bba997016f68440586e38603a55577067396dba482a3f983d372
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # StockFighter
2
2
 
3
- An (unofficial) API for [stockfighter.io](http://stockfighter.io). Designed to be friendly to scripting. Run `bin/console` and start trading!
3
+ An (unofficial) API for [stockfighter.io](http://stockfighter.io). Designed to be friendly to scripting. Run `bundle exec stock_fighter` (or `bin/console`) and start trading!
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage for Scripting
22
22
 
23
- See the following script. The code can also be found in `examples/test_exchange.rb`. Detailed API is listed in `lib/stock_fighter/api_mixin`.
23
+ See the following script. The code can also be found in `examples/test_exchange.rb`. Detailed API is listed in `lib/stock_fighter/api_mixin.rb`.
24
24
 
25
25
  ```ruby
26
26
  require 'stock_fighter/api_mixin'
@@ -35,9 +35,9 @@ stock = "FOOBAR"
35
35
  account = "EXB123456"
36
36
 
37
37
  # Test if the service is up.
38
- ok = send_heartbeat.parsed_response["ok"] rescue false
38
+ ok = send_heartbeat.parsed_response["ok"]
39
39
 
40
- raise "Can't sent heart beat" unless ok
40
+ raise "Can't send heartbeat" unless ok
41
41
 
42
42
  # Get the current orderbook.
43
43
  orderbook = get_orderbook venue, stock
data/bin/stock_fighter ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "stock_fighter"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ include StockFighter::ApiMixin
14
+
15
+ puts """Welcome to the StockFighter Console!
16
+
17
+ Please start by setting your API key:
18
+
19
+ set_api_key 'your_api_key_here'
20
+
21
+ Supported commands:
22
+
23
+ send_heartbeat
24
+ send_venue_heartbeat venue
25
+
26
+ list_stocks venue
27
+ get_orderbook venue, stock
28
+
29
+ place_order venue, stock, account, price:, qty:, direction: 'buy', order_type: 'limit'
30
+ show_order venue, stock, order
31
+ cancel_order venue, stock, order
32
+
33
+ get_quote venue, stock
34
+
35
+ list_account_orders venue, account
36
+ list_account_stock_orders venue, account, stock
37
+
38
+ See http://stockfighter.io for API details.
39
+
40
+ Other commands
41
+ http : A httparty object to send http request, usage: http.get, http.post etc.
42
+ """
43
+
44
+ require "irb"
45
+ IRB.start
@@ -1,3 +1,3 @@
1
1
  module StockFighter
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -15,8 +15,8 @@ Gem::Specification.new do |spec|
15
15
  spec.license = "MIT"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.bindir = "bin"
19
+ spec.executables = spec.files.grep(%r{^bin/stock_fighter}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_runtime_dependency "httparty", "~> 0.13.7"
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stock_fighter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jing Yang
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2016-01-05 00:00:00.000000000 Z
12
12
  dependencies:
@@ -83,7 +83,8 @@ dependencies:
83
83
  description: API for http://stockfighter.io. Run bin/console and start playing!
84
84
  email:
85
85
  - ditsing@gmail.com
86
- executables: []
86
+ executables:
87
+ - stock_fighter
87
88
  extensions: []
88
89
  extra_rdoc_files: []
89
90
  files:
@@ -95,6 +96,7 @@ files:
95
96
  - Rakefile
96
97
  - bin/console
97
98
  - bin/setup
99
+ - bin/stock_fighter
98
100
  - examples/test_exchange.rb
99
101
  - lib/stock_fighter.rb
100
102
  - lib/stock_fighter/api.rb