cryptum 0.0.435 → 0.0.437

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: 45e3962b8301e0d7909ec7f9d68a93eec4bcadebd173a6302250eb6851fc6af5
4
- data.tar.gz: 5d279fffd6e0cd1475423821524b5a9306296929b624e912f5a9a98e50138e8d
3
+ metadata.gz: c52559a0fe9d90cb03287578b9f91831b1dab36fdf53fc27da19872bdfdcfad1
4
+ data.tar.gz: adc165e7481a2feb7388c2ad62fc83fcd2f63909e2f14cf3d7eee2fcf3aed5e6
5
5
  SHA512:
6
- metadata.gz: 58ed11feb49db5f6e1d99376fcc6e5a0149674485108c5d36f4be8f726117c13faf36beccb2b015cbbc135a5fcb6901d92c8717de2bd7125f274332a60f96db8
7
- data.tar.gz: 7237ccf68579d32cf4593d76b985e7a481ae73b2e499ef1ec77b47dd318db330b3e8e0091fb4acd3e05181b7dc3ca75ad47904eba42de52b8c7e056aec1115d3
6
+ metadata.gz: 79c8982aa42b247eb98d74379f29f9f772281724a67f82db957451f9c3dd3c11ded0c196c52ff18ae7c9d9bd8eafdc14d5e306adb573d7dafd536288d701f9cc
7
+ data.tar.gz: e505dfa66f8aa2690c4bdb509ecd4d09b1783d2da6f9c11114ec2587e31fdfe94ac808314ea1de473e33cd6520a5e710cf578426576f1110fa31d3a185901bbc
data/.rubocop.yml CHANGED
@@ -12,7 +12,7 @@ Metrics/BlockLength:
12
12
  Metrics/BlockNesting:
13
13
  Max: 4
14
14
  Metrics/ClassLength:
15
- Max: 132
15
+ Max: 134
16
16
  Metrics/CyclomaticComplexity:
17
17
  Max: 86
18
18
  Metrics/MethodLength:
@@ -11,6 +11,7 @@ module Cryptum
11
11
  :event_type,
12
12
  :first_event,
13
13
  :highest_selling_price,
14
+ :last_purchase_price,
14
15
  :lowest_selling_price,
15
16
  :market_trend_event,
16
17
  :open_sell_orders,
@@ -52,6 +53,7 @@ module Cryptum
52
53
  self.bullish_trend = true
53
54
  self.first_event = true
54
55
  self.highest_selling_price = 0.00
56
+ self.last_purchase_price = 0.00
55
57
  self.lowest_selling_price = 0.00
56
58
  self.open_sell_orders = 0
57
59
  self.open_sell_orders_max = 500
@@ -84,11 +84,14 @@ module Cryptum
84
84
 
85
85
  this_order = event_history.order_book[:order_plan].first
86
86
 
87
- # If price is greater than the lowest selling limit order,
88
- # force it to be slightly less
89
- lowest_selling_price = event_history.lowest_selling_price
87
+ # If price is greater than the lowest selling
88
+ # limit order, force it to be slightly less
89
+ last_order = order_history_meta.reverse.find { |o| o[:color] == 'yellow' }
90
+ # lowest_selling_price = event_history.lowest_selling_price
91
+ event_history.last_purchase_price = last_order[:price].to_f if last_order
92
+ last_purchase_price = event_history.last_purchase_price
90
93
 
91
- limit_price = lowest_selling_price - quote_increment.to_f if lowest_selling_price.positive? && lowest_selling_price < limit_price
94
+ limit_price = last_purchase_price - quote_increment.to_f if last_purchase_price.positive? && last_purchase_price < limit_price
92
95
 
93
96
  price = format(
94
97
  "%0.#{fiat_smallest_decimal}f",
@@ -98,8 +101,9 @@ module Cryptum
98
101
  # Debug last order -------------------------------#
99
102
  # TODO: if the order attempt is unsucessful at the adjusted price,
100
103
  # the order plan needs to be reset.
101
- debug_last_order = "Lowest Limit Sell Price: #{lowest_selling_price}\n"
102
- debug_last_order += "Limit Price (Should be <= #{lowest_selling_price}): #{price}"
104
+ debug_last_order = "Last Order: #{last_order}\n"
105
+ debug_last_order += "Last Purchase Price: #{last_purchase_price}\n"
106
+ debug_last_order += "Limit Price (Should be <= #{last_purchase_price}): #{price}"
103
107
  debug_last_order += "\n\n\n"
104
108
 
105
109
  Cryptum::Log.append(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.435'
4
+ VERSION = '0.0.437'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.435
4
+ version: 0.0.437
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.