stockfighter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a4dbaa3414c3edfb0c0d4e0982e283aa5d758a8
4
- data.tar.gz: 3a699ce75deabe0078c0af18a3b21e5173bdec0b
3
+ metadata.gz: 3133a56c01c50225b606c5a027a4450892ad4c19
4
+ data.tar.gz: d2e02e42f70aff2bacd3b060d782e42f815f77a5
5
5
  SHA512:
6
- metadata.gz: a85ba12c74fae4f8ad5bde80a4bb9fe89d5089441ccf18c4227f32ff1bacbac2969bf1badcc15cdea25283bb43538463eddb4ea5513466f90e6f472b7fd5abcc
7
- data.tar.gz: 7d2e5aa2e96c0ab13b342d57b99a4653376940b93de785613e6bccba96bd1a6155e7cc21d8d45d05b9139a035f7ceb547865381448a78d61e40f62da1c665e19
6
+ metadata.gz: 1252862680f92e3968c730baaf1e9361548b7f9c7ed99d61685ec66b1a152454f2ef76c4459ac4ab86178bb8ce3e8419c131e5c21ccf66e78717ac423731b9ee
7
+ data.tar.gz: 8ad9d93e6ae4559e4bce99b632208fa5eb3a5f026aedbcbdd646e8a8c1c604deae64984fd8d1a30e9c2fbe609e1298e1683dbbf48555f15c694570efcf210eed
data/README.md CHANGED
@@ -26,19 +26,25 @@ require 'stockfighter'
26
26
 
27
27
  # Use the GM to fetch the info automatically
28
28
 
29
- gm = Stockfighter::GM.new("supersecretapikey1234567")
30
- first_steps_config = gm.config_for(level: "first_steps")
29
+ gm = Stockfighter::GM.new(key: "supersecretapikey1234567", level: "first_steps")
31
30
 
32
- api = Stockfighter::Api.new(first_steps_config)
31
+ api = Stockfighter::Api.new(gm.config)
33
32
 
34
- # Or initialize manually
33
+ # Restart the level
35
34
 
36
- key = "supersecretapikey1234567"
37
- account = "ACT123456789"
38
- symbol = "ABC"
39
- venue = "DEFGHEX"
35
+ gm.restart
40
36
 
41
- api = Stockfighter::Api.new(key: key, account: account, symbol: symbol, venue: venue)
37
+ # Resume the level
38
+
39
+ gm.resume
40
+
41
+ # Stop the level
42
+
43
+ gm.stop
44
+
45
+ # Check if the level is active
46
+
47
+ gm.active?
42
48
 
43
49
  # Print the order book
44
50
  puts api.order_book
@@ -69,6 +75,15 @@ puts cancellation["totalFilled"]
69
75
  # Print the status of all your orders for the stock on the venue
70
76
  puts api.status_all
71
77
 
78
+ # API can also be initialized manually
79
+
80
+ key = "supersecretapikey1234567"
81
+ account = "ACT123456789"
82
+ symbol = "ABC"
83
+ venue = "DEFGHEX"
84
+
85
+ api = Stockfighter::Api.new(key: key, account: account, symbol: symbol, venue: venue)
86
+
72
87
  ```
73
88
 
74
89
  ## Todo
@@ -76,6 +91,7 @@ puts api.status_all
76
91
  * ~~TODO: Usage instructions!~~
77
92
  * ~~TODO: Game master integration~~
78
93
  * TODO: Tests
94
+ * TODO: Error Handling
79
95
 
80
96
  ## Contributing
81
97
 
@@ -48,16 +48,16 @@ module Stockfighter
48
48
  response = HTTParty.get("#{GM_URL}/instances/#{@instance_id}", :headers => {"X-Starfighter-Authorization" => @api_key})
49
49
  response["done"] && response["ok"]
50
50
  end
51
- end
52
51
 
53
- def update_config(resp)
54
- @config = {}
55
- @config[:key] = @api_key
56
- @config[:account] = resp["account"]
57
- @config[:venue] = resp["venues"][0]
58
- @config[:symbol] = resp["tickers"][0]
52
+ def update_config(resp)
53
+ @config = {}
54
+ @config[:key] = @api_key
55
+ @config[:account] = resp["account"]
56
+ @config[:venue] = resp["venues"][0]
57
+ @config[:symbol] = resp["tickers"][0]
59
58
 
60
- @instance_id = resp["instanceId"]
59
+ @instance_id = resp["instanceId"]
60
+ end
61
+ private :update_config
61
62
  end
62
- private :update_config
63
63
  end
@@ -1,3 +1,3 @@
1
1
  module Stockfighter
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stockfighter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert J Samson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-12 00:00:00.000000000 Z
11
+ date: 2015-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty