stock_pivot 0.0.1 → 0.0.2
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/README.md +1 -1
- data/lib/stock_pivot/cli.rb +15 -11
- data/lib/stock_pivot/version.rb +1 -1
- data/stock_pivot.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b9205e34e62890b7146b8ea08421aec044fc8c5
|
4
|
+
data.tar.gz: 9fd337ed2ddae4b5df669215d82b3df261063d4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 762fef32c5c1c6cae40f9409900752027365eb736a4239bab30dc6cd3012ad827508e5c8868286acd68b5586cdfc53dbdb8bac42170d65cb60ee7732453af0df
|
7
|
+
data.tar.gz: f24b2dcc069d6850e659928b6773f893bbdf062dfdd524f4681ed5570c0a4ee7c653e25ea3a706c2a67fd6fe86b80f5863610b5effbd4beade52ac0d168c9fea
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
## Contributing
|
28
28
|
|
29
|
-
1. Fork it ( https://github.com/
|
29
|
+
1. Fork it ( https://github.com/scottvrosenthal/stock_pivot/fork )
|
30
30
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
31
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
32
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/stock_pivot/cli.rb
CHANGED
@@ -10,13 +10,17 @@ module StockPivot
|
|
10
10
|
I18n.enforce_available_locales = false
|
11
11
|
|
12
12
|
desc 'trade SYMBOL MARGIN_BALANCE', 'calculate shares to go long/short based on last eod quote'
|
13
|
+
option :margin_ratio, type: :numeric, aliases: :m
|
13
14
|
option :risk_ratio, type: :numeric, aliases: :r
|
15
|
+
option :commission, type: :numeric, aliases: :c
|
14
16
|
def trade(symbol, margin_balance)
|
15
17
|
args = {}
|
16
18
|
args[:symbol] = symbol.upcase
|
17
19
|
args[:margin_balance] = margin_balance.to_d
|
18
20
|
|
21
|
+
args[:margin_ratio] = options[:margin_ratio] if options[:margin_ratio]
|
19
22
|
args[:risk_ratio] = options[:risk_ratio] if options[:risk_ratio]
|
23
|
+
args[:commission] = options[:commission] if options[:commission]
|
20
24
|
|
21
25
|
quotes = StockPivot::Quotes.feed(symbol)
|
22
26
|
|
@@ -32,8 +36,8 @@ module StockPivot
|
|
32
36
|
say Rainbow("Margin ratio: #{number_to_percentage(trading.margin_ratio)}").yellow
|
33
37
|
say Rainbow("Buying power: #{number_to_currency(trading.buying_power)}").cyan
|
34
38
|
say Rainbow("Buying power risk ratio: #{number_to_percentage(trading.risk_ratio)}").yellow
|
35
|
-
say Rainbow("Margin risk amount: #{number_to_currency(trading.risk_amount)}").
|
36
|
-
say Rainbow("Trade commission: #{number_to_currency(trading.commission * 2)}").
|
39
|
+
say Rainbow("Margin risk amount: (#{number_to_currency(trading.risk_amount)})").magenta
|
40
|
+
say Rainbow("Trade commission (open/close): (#{number_to_currency(trading.commission * 2)})").magenta
|
37
41
|
|
38
42
|
say "\n"
|
39
43
|
say '-' * 80
|
@@ -49,27 +53,27 @@ module StockPivot
|
|
49
53
|
|
50
54
|
say Rainbow("Long trade:").cyan.underline
|
51
55
|
say Rainbow("#1 - BUY: #{trading.long_share_size}s @ #{trading.last_eod.high} EXP DAY - TO OPEN").green
|
52
|
-
say Rainbow("#2 - SELL: #{trading.long_share_size}s @ #{trading.last_eod.low} EXP GTC - TO CLOSE").
|
56
|
+
say Rainbow("#2 - SELL: #{trading.long_share_size}s @ #{trading.last_eod.low} EXP GTC - TO CLOSE").magenta
|
53
57
|
say Rainbow("** ALL IN").yellow.underline if trading.long_all_in
|
54
|
-
say Rainbow("** Long
|
58
|
+
say Rainbow("** Long trade risk amount: (#{number_to_currency(trading.long_risk_amount)})").white
|
55
59
|
say "\n"
|
56
|
-
say Rainbow("Long 3X Profit target - OCO:").cyan.underline
|
57
|
-
say Rainbow("#3 - Profit target - SELL: #{trading.long_share_size}s @ #{trading.last_eod.high + (trading.last_eod.range * 3.00)} EXP GTC - TO CLOSE").
|
58
|
-
say Rainbow("
|
60
|
+
say Rainbow("Long 3X [Risk reward/Profit target] - OCO:").cyan.underline
|
61
|
+
say Rainbow("#3 - Profit target - SELL: #{trading.long_share_size}s @ #{trading.last_eod.high + (trading.last_eod.range * 3.00)} EXP GTC - TO CLOSE").magenta
|
62
|
+
say Rainbow("Possible profit amount: #{number_to_currency(trading.long_risk_amount * 3.00)}").white
|
59
63
|
|
60
64
|
say "\n"
|
61
65
|
say '-' * 80
|
62
66
|
say "\n"
|
63
67
|
|
64
68
|
say Rainbow("Short trade:").cyan.underline
|
65
|
-
say Rainbow("#1 - SELL: #{trading.short_share_size}s @ #{trading.last_eod.low} EXP DAY - TO OPEN").
|
69
|
+
say Rainbow("#1 - SELL: #{trading.short_share_size}s @ #{trading.last_eod.low} EXP DAY - TO OPEN").magenta
|
66
70
|
say Rainbow("#2 - BUY: #{trading.short_share_size}s @ #{trading.last_eod.high} EXP GTC - TO CLOSE").green
|
67
71
|
say Rainbow("** ALL IN").yellow.underline if trading.short_all_in
|
68
|
-
say Rainbow("** Short
|
72
|
+
say Rainbow("** Short trade risk amount: (#{number_to_currency(trading.short_risk_amount)})").white
|
69
73
|
say "\n"
|
70
|
-
say Rainbow("Short 3X Profit target - OCO:").cyan.underline
|
74
|
+
say Rainbow("Short 3X [Risk reward/Profit target] - OCO:").cyan.underline
|
71
75
|
say Rainbow("#3 - Profit target - BUY: #{trading.short_share_size}s @ #{trading.last_eod.low - (trading.last_eod.range * 3.00)} EXP GTC - TO CLOSE").green
|
72
|
-
say Rainbow("
|
76
|
+
say Rainbow("Possible profit amount: #{number_to_currency(trading.short_risk_amount * 3.00)}").white
|
73
77
|
|
74
78
|
say "\n"
|
75
79
|
say '-' * 80
|
data/lib/stock_pivot/version.rb
CHANGED
data/stock_pivot.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['sr7575@gmail.com']
|
11
11
|
spec.summary = %q{Given a stock symbol & margin balance, stockpivot will calculate tomorrow's possible long/short trades.}
|
12
12
|
spec.description = %q{Given a stock symbol & margin balance, stockpivot will calculate tomorrow's possible long/short trades.}
|
13
|
-
spec.homepage = ''
|
13
|
+
spec.homepage = 'https://github.com/scottvrosenthal/stock_pivot'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stock_pivot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott V. Rosenthal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -219,7 +219,7 @@ files:
|
|
219
219
|
- spec/stock_pivot/quotes_spec.rb
|
220
220
|
- spec/stock_pivot/trading_spec.rb
|
221
221
|
- stock_pivot.gemspec
|
222
|
-
homepage:
|
222
|
+
homepage: https://github.com/scottvrosenthal/stock_pivot
|
223
223
|
licenses:
|
224
224
|
- MIT
|
225
225
|
metadata: {}
|