ig_markets 0.7 → 0.8
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 +4 -4
- data/CHANGELOG.md +9 -2
- data/lib/ig_markets/cli/commands/prices_command.rb +15 -14
- data/lib/ig_markets/dealing_platform/account_methods.rb +1 -0
- data/lib/ig_markets/model.rb +15 -4
- data/lib/ig_markets/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 905ebb175a410a5b6a86f1b92c215745e642e04b
|
4
|
+
data.tar.gz: 6bb5b7d2360c936c46c2380002a15f632b853b63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0abc1a40d8fb0c4ef98835c40cf525c129ea5623dc23cff94792034431d2109ce164dbbea6d1097fef176b599c3ae823d88d9aa1bb78f330a7a10ce919239aa9
|
7
|
+
data.tar.gz: e0a4e9984d8eb1286ef8e92547512ec1cafb94fbdfc14bb152ffba9f9ff41072d8475b54805da3e1db7191bbf7b41ee958dc1f37e0e73ced7642e6a1f945cbb8
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# IG Markets Changelog
|
2
2
|
|
3
|
-
### 0.
|
3
|
+
### 0.8 — April 30, 2016
|
4
|
+
|
5
|
+
- The `ig_markets` prices command now takes `--from` and `--to` arguments accurate to one second
|
6
|
+
- Fixed incomplete data being returned by `IGMarkets::DealingPlatform::AccountMethods#activities` and
|
7
|
+
`IGMarkets::DealingPlatform::AccountMethods#transactions`
|
8
|
+
- Fixed errors calling `IGMarkets::DealingPlatform#instantiate_models` for models that have deprecated attributes
|
9
|
+
|
10
|
+
### 0.7 — April 30, 2016
|
4
11
|
|
5
12
|
- Added `ig_markets console` command which logs in then opens a live Ruby console
|
6
13
|
- Merged `IGMarkets::DealingPlatform::AccountMethods#activities_in_date_range` and
|
@@ -44,7 +51,7 @@
|
|
44
51
|
- Added `IGMarkets::Position#close_level`
|
45
52
|
- Removed `IGMarkets::Position#formatted_size` and `IGMarkets::Transaction#formatted_transaction_type`
|
46
53
|
|
47
|
-
### 0.4 — April
|
54
|
+
### 0.4 — April 17, 2016
|
48
55
|
|
49
56
|
- Added `create`, `update` and `delete` subcommands to `ig_markets orders`
|
50
57
|
- Added `create`, `update` and `close` subcommands to `ig_markets positions`
|
@@ -5,14 +5,14 @@ module IGMarkets
|
|
5
5
|
desc 'prices', 'Prints historical prices for a market'
|
6
6
|
|
7
7
|
option :epic, required: true, desc: 'The EPIC of the market to print historical prices for'
|
8
|
-
option :resolution, enum: %w(minute minute-2 minute-3 minute-5 minute-10 minute-15 minute-30 hour hour-2
|
9
|
-
hour-4 day week month), required: true, desc: 'The price resolution'
|
8
|
+
option :resolution, enum: %w(second minute minute-2 minute-3 minute-5 minute-10 minute-15 minute-30 hour hour-2
|
9
|
+
hour-3 hour-4 day week month), required: true, desc: 'The price resolution'
|
10
10
|
option :number, type: :numeric, desc: 'The number of historical prices to return, if this is specified then ' \
|
11
|
-
'--
|
12
|
-
option :
|
13
|
-
|
14
|
-
option :
|
15
|
-
|
11
|
+
'--from and --to are ignored, otherwise they are required'
|
12
|
+
option :from, desc: 'The start of the period to return prices for, required unless --number is specified, ' \
|
13
|
+
'format: yyyy-mm-ddThh:mm:ss(+|-)zz:zz'
|
14
|
+
option :to, desc: 'The end of the period to return prices for, required unless --number is specified, ' \
|
15
|
+
'format: yyyy-mm-ddThh:mm:ss(+|-)zz:zz'
|
16
16
|
|
17
17
|
def prices
|
18
18
|
self.class.begin_session(options) do |dealing_platform|
|
@@ -43,24 +43,25 @@ END
|
|
43
43
|
|
44
44
|
if options[:number]
|
45
45
|
historical_price_result_from_number market
|
46
|
-
elsif options[:
|
46
|
+
elsif options[:from] && options[:to]
|
47
47
|
historical_price_result_from_date_range market
|
48
48
|
else
|
49
|
-
raise ArgumentError, 'specify --number or both --
|
49
|
+
raise ArgumentError, 'specify --number or both --from and --to'
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
def historical_price_result_from_number(market)
|
54
|
-
market.historical_prices resolution: resolution,
|
54
|
+
market.historical_prices resolution: resolution, number: options[:number]
|
55
55
|
end
|
56
56
|
|
57
57
|
def historical_price_result_from_date_range(market)
|
58
|
-
filtered = self.class.filter_options options, [:
|
58
|
+
filtered = self.class.filter_options options, [:from, :to]
|
59
59
|
|
60
|
-
|
61
|
-
|
60
|
+
[:from, :to].each do |attribute|
|
61
|
+
self.class.parse_date_time filtered, attribute, Time, '%FT%T%z', 'yyyy-mm-ddThh:mm:ss(+|-)zz:zz'
|
62
|
+
end
|
62
63
|
|
63
|
-
market.historical_prices resolution: resolution, from: filtered[:
|
64
|
+
market.historical_prices resolution: resolution, from: filtered[:from], to: filtered[:to]
|
64
65
|
end
|
65
66
|
end
|
66
67
|
end
|
@@ -79,6 +79,7 @@ module IGMarkets
|
|
79
79
|
options[:maxSpanSeconds] = (options.delete(:days).to_f * 24 * 60 * 60).to_i if options.key? :days
|
80
80
|
options[:from] = options[:from].strftime('%F') if options.key? :from
|
81
81
|
options[:to] = options[:to].strftime('%F') if options.key? :to
|
82
|
+
options[:pageSize] = 0
|
82
83
|
end
|
83
84
|
end
|
84
85
|
end
|
data/lib/ig_markets/model.rb
CHANGED
@@ -68,11 +68,14 @@ module IGMarkets
|
|
68
68
|
# @return [Hash] A hash containing details of all attributes that have been defined on this model.
|
69
69
|
attr_accessor :defined_attributes
|
70
70
|
|
71
|
+
# @return [Hash] The names of the deprecated attributes on this model.
|
72
|
+
attr_accessor :deprecated_attributes
|
73
|
+
|
71
74
|
# Returns the names of all currently defined attributes for this model.
|
72
75
|
#
|
73
76
|
# @return [Array<Symbol>]
|
74
77
|
def defined_attribute_names
|
75
|
-
(defined_attributes
|
78
|
+
Hash(defined_attributes).keys
|
76
79
|
end
|
77
80
|
|
78
81
|
# Returns the type of the specified attribute.
|
@@ -81,7 +84,9 @@ module IGMarkets
|
|
81
84
|
#
|
82
85
|
# @return The type of the specified attribute.
|
83
86
|
def attribute_type(attribute_name)
|
84
|
-
|
87
|
+
return NilClass if Array(deprecated_attributes).include? attribute_name
|
88
|
+
|
89
|
+
Hash(defined_attributes).fetch(attribute_name).fetch :type
|
85
90
|
end
|
86
91
|
|
87
92
|
# Returns the array of allowed values for the specified attribute that was passed to {attribute}.
|
@@ -90,7 +95,7 @@ module IGMarkets
|
|
90
95
|
#
|
91
96
|
# @return [Array]
|
92
97
|
def allowed_values(attribute_name)
|
93
|
-
defined_attributes.fetch(attribute_name).fetch :allowed_values
|
98
|
+
Hash(defined_attributes).fetch(attribute_name).fetch :allowed_values
|
94
99
|
end
|
95
100
|
|
96
101
|
# Defines setter and getter methods for a new attribute on this class.
|
@@ -118,11 +123,17 @@ module IGMarkets
|
|
118
123
|
end
|
119
124
|
|
120
125
|
# Defines a no-op setter method for each of the passed attribute names. This is used to silently allow deprecated
|
121
|
-
# attributes to be set on the model but not have them be
|
126
|
+
# attributes to be set on the model but not have them be part of the model's structure.
|
127
|
+
#
|
128
|
+
# @param [Array<Symbol>] names The names of the deprecated attributes.
|
129
|
+
#
|
130
|
+
# @return [void]
|
122
131
|
def deprecated_attribute(*names)
|
123
132
|
names.each do |name|
|
124
133
|
define_method "#{name}=" do |_value|
|
125
134
|
end
|
135
|
+
|
136
|
+
(self.deprecated_attributes ||= []) << name
|
126
137
|
end
|
127
138
|
end
|
128
139
|
|
data/lib/ig_markets/version.rb
CHANGED