stockfighter 0.3.0 → 0.3.1

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: 885259cfcbbb561e9bfcc16d21394302b6615f82
4
- data.tar.gz: c1e9ebf5573a7056adcd8a154562b0fa0d76d015
3
+ metadata.gz: 68adc328d3d355eff80ad92e8254f5e96ce8a0f1
4
+ data.tar.gz: b3ee6f33a1e53a8fe9661e5708c67c21f24b642b
5
5
  SHA512:
6
- metadata.gz: 0093757ab0fd12e8ae655809826e5424f943be049bd9bb146bd35373b6a94cf64e60d8e8ea0059c09a250acefa77f60e1501f05a23c756019ef31613dc705178
7
- data.tar.gz: a79a9cb440da8136034f8f6d19787329def1c2fbbbe9aaf002e22efcdf9d320a90bfa3f771399d8ad3bd6fa6830faa2ec8060c9ea8d989cb454e2e42147474bd
6
+ metadata.gz: 600d0eb1c467c8292b9dfe1b914e78092a885f109cf70018026c2500b578e8342fdd060d52a38237946ec92d6e91e5fa094f8c0eda93d075eb97db6044a7602f
7
+ data.tar.gz: a021f108dacd96883bb97eb513ddbb06972b6fb408fea03c602e0cf2ce6ef0985160c4bbd4c6fac24ee661bddf2be01537eecccdb89619a0a9ee9b2334c998d1
data/README.md CHANGED
@@ -117,15 +117,16 @@ api = Stockfighter::Api.new(key: key, account: account, symbol: symbol, venue: v
117
117
 
118
118
  # Websockets api example
119
119
 
120
+ ```ruby
120
121
  websockets = Stockfighter::Websockets.new(gm.config)
121
122
  websockets.add_quote_callback { |quote|
122
123
  puts quote
123
124
  }
124
125
  websockets.add_execution_callback { |execution|
125
- puts execution
126
+ puts execution
126
127
  }
127
128
  websockets.start()
128
-
129
+ ```
129
130
 
130
131
  ## Todo
131
132
 
@@ -12,7 +12,7 @@ module Stockfighter
12
12
  end
13
13
 
14
14
  def get_quote
15
- HTTParty.get("#{BASE_URL}/venues/#{@venue}/stocks/#{@symbol}/quote", {"X-Starfighter-Authorization" => @api_key}).parsed_response
15
+ HTTParty.get("#{BASE_URL}/venues/#{@venue}/stocks/#{@symbol}/quote", auth_header).parsed_response
16
16
  end
17
17
 
18
18
  def place_order(price:, quantity:, direction:, order_type:)
@@ -27,28 +27,35 @@ module Stockfighter
27
27
  }
28
28
 
29
29
  HTTParty.post("#{BASE_URL}/venues/#{@venue}/stocks/#{@symbol}/orders", body: JSON.dump(order),
30
- headers: {"X-Starfighter-Authorization" => @api_key}).parsed_response
30
+ headers: auth_header).parsed_response
31
31
  end
32
32
 
33
33
  def cancel_order(order_id)
34
- HTTParty.delete("#{BASE_URL}/venues/#{@venue}/stocks/#{@symbol}/orders/#{order_id}", headers: {"X-Starfighter-Authorization" => @api_key})
34
+ HTTParty.delete("#{BASE_URL}/venues/#{@venue}/stocks/#{@symbol}/orders/#{order_id}", headers: auth_header)
35
35
  end
36
36
 
37
37
  def order_status(order_id)
38
- HTTParty.get("#{BASE_URL}/venues/#{@venue}/stocks/#{@symbol}/orders/#{order_id}", :headers => {"X-Starfighter-Authorization" => @api_key}).parsed_response
38
+ HTTParty.get("#{BASE_URL}/venues/#{@venue}/stocks/#{@symbol}/orders/#{order_id}", headers: auth_header).parsed_response
39
39
  end
40
40
 
41
41
  def order_book
42
- HTTParty.get("#{BASE_URL}/venues/#{@venue}/stocks/#{@symbol}", headers: {"X-Starfighter-Authorization" => @api_key}).parsed_response
42
+ HTTParty.get("#{BASE_URL}/venues/#{@venue}/stocks/#{@symbol}", headers: auth_header).parsed_response
43
43
  end
44
44
 
45
45
  def venue_up?
46
- response = HTTParty.get("#{BASE_URL}/venues/#{@venue}/heartbeat", headers: {"X-Starfighter-Authorization" => @api_key}).parsed_response
46
+ response = HTTParty.get("#{BASE_URL}/venues/#{@venue}/heartbeat", headers: auth_header).parsed_response
47
47
  response["ok"]
48
48
  end
49
49
 
50
50
  def status_all
51
- HTTParty.get("#{BASE_URL}/venues/#{@venue}/accounts/#{@account}/orders", headers: {"X-Starfighter-Authorization" => @api_key})
51
+ HTTParty.get("#{BASE_URL}/venues/#{@venue}/accounts/#{@account}/orders", headers: auth_header)
52
52
  end
53
+
54
+ def auth_header
55
+ {"X-Starfighter-Authorization" => @api_key}
56
+ end
57
+
58
+ private :auth_header
59
+
53
60
  end
54
61
  end
@@ -1,3 +1,3 @@
1
1
  module Stockfighter
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/stockfighter.gemspec CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency "httparty", "~> 0.13.7"
22
- spec.add_runtime_dependency "rufus-scheduler", "~> 3.1.10"
23
- spec.add_runtime_dependency "websocket-eventmachine-client", "~> 1.1.0"
22
+ spec.add_runtime_dependency "rufus-scheduler", "~> 3.1"
23
+ spec.add_runtime_dependency "websocket-eventmachine-client", "~> 1.1"
24
24
  spec.add_development_dependency "bundler", "~> 1.7"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  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.3.0
4
+ version: 0.3.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-19 00:00:00.000000000 Z
11
+ date: 2015-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.10
33
+ version: '3.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.1.10
40
+ version: '3.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: websocket-eventmachine-client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.1.0
47
+ version: '1.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.1.0
54
+ version: '1.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement