alpaca-trade-api 0.4.1 → 0.5.0

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
  SHA256:
3
- metadata.gz: ba57fd54ccd0a236de1df1cdd23607f499a91aae2fddbcd50d55e4dc4771f0f7
4
- data.tar.gz: f3afbb858f959225b9175bd2cb583af8015a72588db5b9dd8779c318f1c565ca
3
+ metadata.gz: 7e5e11fb99efb22e866a8f2cba25f51c4461243a1e29c6a27bca7e37f6d90ab6
4
+ data.tar.gz: bf33b4ac115ec3db6d12f1f9e8463dccd0c33bef5eeba88625ee3e0ca8583f42
5
5
  SHA512:
6
- metadata.gz: 51f352eb15a99c7cfb3762329e1842b62d4e3815355bd1802ec8cc801c5a456cb5babfd972212813e4e68c051540c066870db437387798c6968eaa7ba93f4bb1
7
- data.tar.gz: cee5e5c009e00bf21e2a1d48c83febff8900d8d696c77aa74334043ca1c8922ac3002df9aff82eef8a375312f01f980fa5872f4cdfc1b05c978b585ca0066e12
6
+ metadata.gz: c6c4b7f0efdd86c0930db2e7c4cda494faab106722afa5d4187b242750e9885f2ae8845af1ca947200be2432869f0503fc9a11bff47dde20762259b5aa44bf00
7
+ data.tar.gz: 9a9900150e64e4c9e7366578edf42fcb803c08f97a622737f55678e00227f309ae6a8718cf76fe4e7e7f5b340bbb8d914308f2bfbdcf55dfea3fae74c72e7437
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.5.0] - 2020-05-25
8
+ ### Added
9
+ - Implemented Client#last_trade. Thanks @nathanworden.
10
+
7
11
  ## [0.4.1] - 2020-04-25
8
12
  ### Fixed
9
13
  - Added explicit `BigDecimal` require.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- alpaca-trade-api (0.4.1)
4
+ alpaca-trade-api (0.5.0)
5
5
  faraday (~> 0.15)
6
6
 
7
7
  GEM
@@ -8,6 +8,7 @@ require 'alpaca/trade/api/asset'
8
8
  require 'alpaca/trade/api/bar'
9
9
  require 'alpaca/trade/api/calendar'
10
10
  require 'alpaca/trade/api/clock'
11
+ require 'alpaca/trade/api/last_trade'
11
12
  require 'alpaca/trade/api/order'
12
13
  require 'alpaca/trade/api/position'
13
14
 
@@ -97,6 +97,13 @@ module Alpaca
97
97
  end
98
98
  end
99
99
 
100
+ def last_trade(symbol:)
101
+ response = get_request(data_endpoint, "v1/last/stocks/#{symbol}")
102
+ raise InvalidRequest, JSON.parse(response.body)['message'] if response.status == 404
103
+
104
+ LastTrade.new(JSON.parse(response.body))
105
+ end
106
+
100
107
  def new_order(symbol:, qty:, side:, type:, time_in_force:, limit_price: nil,
101
108
  stop_price: nil, extended_hours: false, client_order_id: nil, order_class: nil,
102
109
  take_profit: nil, stop_loss: nil)
@@ -0,0 +1,15 @@
1
+ module Alpaca
2
+ module Trade
3
+ module Api
4
+ class LastTrade
5
+ attr_reader :status, :symbol, :last
6
+
7
+ def initialize(json)
8
+ @status = json['status']
9
+ @symbol = json['symbol']
10
+ @last = json['last']
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -3,7 +3,7 @@
3
3
  module Alpaca
4
4
  module Trade
5
5
  module Api
6
- VERSION = '0.4.1'
6
+ VERSION = '0.5.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alpaca-trade-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloves Carneiro Jr
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-26 00:00:00.000000000 Z
11
+ date: 2020-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -165,6 +165,7 @@ files:
165
165
  - lib/alpaca/trade/api/clock.rb
166
166
  - lib/alpaca/trade/api/configuration.rb
167
167
  - lib/alpaca/trade/api/errors.rb
168
+ - lib/alpaca/trade/api/last_trade.rb
168
169
  - lib/alpaca/trade/api/order.rb
169
170
  - lib/alpaca/trade/api/position.rb
170
171
  - lib/alpaca/trade/api/version.rb