quantitative 0.1.4 → 0.1.5

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.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quantitative
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Lang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-21 00:00:00.000000000 Z
11
+ date: 2024-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -44,12 +44,18 @@ files:
44
44
  - LICENSE
45
45
  - README.md
46
46
  - Rakefile
47
+ - lib/quant/asset.rb
48
+ - lib/quant/asset_class.rb
49
+ - lib/quant/attributes.rb
47
50
  - lib/quant/config.rb
48
51
  - lib/quant/errors.rb
49
52
  - lib/quant/indicators.rb
50
53
  - lib/quant/indicators/indicator.rb
51
54
  - lib/quant/indicators/indicator_point.rb
52
55
  - lib/quant/indicators/ma.rb
56
+ - lib/quant/indicators/ping.rb
57
+ - lib/quant/indicators_proxy.rb
58
+ - lib/quant/indicators_sources.rb
53
59
  - lib/quant/interval.rb
54
60
  - lib/quant/mixins/direction.rb
55
61
  - lib/quant/mixins/filters.rb
@@ -61,8 +67,6 @@ files:
61
67
  - lib/quant/mixins/trig.rb
62
68
  - lib/quant/mixins/weighted_average.rb
63
69
  - lib/quant/refinements/array.rb
64
- - lib/quant/security.rb
65
- - lib/quant/security_class.rb
66
70
  - lib/quant/series.rb
67
71
  - lib/quant/settings.rb
68
72
  - lib/quant/settings/indicators.rb
@@ -1,80 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "security_class"
4
-
5
- module Quant
6
- # A +Security+ is a representation of a financial instrument such as a stock, option, future, or currency.
7
- # It is used to represent the instrument that is being traded, analyzed, or managed.
8
- # @example
9
- # security = Quant::Security.new(symbol: "AAPL", name: "Apple Inc.", security_class: :stock, exchange: "NASDAQ")
10
- # security.symbol # => "AAPL"
11
- # security.name # => "Apple Inc."
12
- # security.stock? # => true
13
- # security.option? # => false
14
- # security.future? # => false
15
- # security.currency? # => false
16
- # security.exchange # => "NASDAQ"
17
- # security.to_h # => { "s" => "AAPL", "n" => "Apple Inc.", "sc" => "stock", "x" => "NASDAQ" }
18
- class Security
19
- attr_reader :symbol, :name, :security_class, :id, :exchange, :source, :meta, :created_at, :updated_at
20
-
21
- def initialize(
22
- symbol:,
23
- name: nil,
24
- id: nil,
25
- active: true,
26
- tradeable: true,
27
- exchange: nil,
28
- source: nil,
29
- security_class: nil,
30
- created_at: Quant.current_time,
31
- updated_at: Quant.current_time,
32
- meta: {}
33
- )
34
- raise ArgumentError, "symbol is required" unless symbol
35
-
36
- @symbol = symbol.to_s.upcase
37
- @name = name
38
- @id = id
39
- @tradeable = tradeable
40
- @active = active
41
- @exchange = exchange
42
- @source = source
43
- @security_class = SecurityClass.new(security_class)
44
- @created_at = created_at
45
- @updated_at = updated_at
46
- @meta = meta
47
- end
48
-
49
- def active?
50
- !!@active
51
- end
52
-
53
- def tradeable?
54
- !!@tradeable
55
- end
56
-
57
- SecurityClass::CLASSES.each do |class_name|
58
- define_method("#{class_name}?") do
59
- security_class == class_name
60
- end
61
- end
62
-
63
- def to_h(full: false)
64
- return { "s" => symbol } unless full
65
-
66
- { "s" => symbol,
67
- "n" => name,
68
- "id" => id,
69
- "t" => tradeable?,
70
- "a" => active?,
71
- "x" => exchange,
72
- "sc" => security_class.to_s,
73
- "src" => source.to_s }
74
- end
75
-
76
- def to_json(*args, full: false)
77
- Oj.dump(to_h(full: full), *args)
78
- end
79
- end
80
- end