cryptum 0.0.241 → 0.0.242
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/Gemfile +3 -3
- data/lib/cryptum/api.rb +11 -5
- data/lib/cryptum/event/buy.rb +5 -4
- data/lib/cryptum/event/sell.rb +4 -3
- data/lib/cryptum/ui/order_execution.rb +8 -4
- data/lib/cryptum/ui/order_plan.rb +3 -3
- data/lib/cryptum/version.rb +1 -1
- metadata +8 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 58239e6d710cb64870c47caa59a8c48cbef1b5dc008c6cb4b8307108ef75791a
         | 
| 4 | 
            +
              data.tar.gz: ef6e609003c09ee228fbaee253a362a74ef866939fc96073ab2b02b2688e59b0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 1f1d21f9b7449bdfbf351c437223c4c359496d922dc569005bde20a98c339c1419db58a0206ddb44186ceea7d431984b4095bcd8ab6ece7db49a88f9dcb10156
         | 
| 7 | 
            +
              data.tar.gz: 874d6e04dad3e6ff8fc555160eda33d0ba3b391df5a6dbfb0c069bf034d2105ceb6adc622c18a5400662d9dddf5aaf744cd78d196f4f08b17d28f2149cf20a7d
         | 
    
        data/Gemfile
    CHANGED
    
    | @@ -12,7 +12,7 @@ gemspec | |
| 12 12 | 
             
            # to build appropriately.  Defer to ./reinstall_coinbot_gemset.sh
         | 
| 13 13 | 
             
            # to review these custom flags
         | 
| 14 14 | 
             
            gem 'addressable', '2.8.0'
         | 
| 15 | 
            -
            gem 'bundler', '>=2.3. | 
| 15 | 
            +
            gem 'bundler', '>=2.3.17'
         | 
| 16 16 | 
             
            gem 'bundler-audit', '0.9.1'
         | 
| 17 17 | 
             
            gem 'curses', '1.4.4'
         | 
| 18 18 | 
             
            gem 'eventmachine', '1.2.7'
         | 
| @@ -25,9 +25,9 @@ gem 'rdoc', '6.4.0' | |
| 25 25 | 
             
            gem 'require_all', '3.0.0'
         | 
| 26 26 | 
             
            gem 'rest-client', '2.1.0'
         | 
| 27 27 | 
             
            gem 'rspec', '3.11.0'
         | 
| 28 | 
            -
            gem 'rubocop', '1. | 
| 28 | 
            +
            gem 'rubocop', '1.31.1'
         | 
| 29 29 | 
             
            gem 'rubocop-rake', '0.6.0'
         | 
| 30 | 
            -
            gem 'rubocop-rspec', '2. | 
| 30 | 
            +
            gem 'rubocop-rspec', '2.12.1'
         | 
| 31 31 | 
             
            gem 'ruby-prof', '1.4.3'
         | 
| 32 32 | 
             
            gem 'rvm', '1.11.3.9'
         | 
| 33 33 | 
             
            gem 'sinatra', '2.2.0'
         | 
    
        data/lib/cryptum/api.rb
    CHANGED
    
    | @@ -85,8 +85,10 @@ module Cryptum | |
| 85 85 | 
             
                  api_key = env[:api_key]
         | 
| 86 86 | 
             
                  api_secret = env[:api_secret]
         | 
| 87 87 | 
             
                  api_passphrase = env[:api_passphrase]
         | 
| 88 | 
            -
                  api_endpoint = 'https://api. | 
| 88 | 
            +
                  api_endpoint = 'https://api.exchange.coinbase.com'
         | 
| 89 89 | 
             
                  api_endpoint = 'https://api-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
         | 
| 90 | 
            +
                  # api_endpoint = 'https://api.pro.coinbase.com'
         | 
| 91 | 
            +
                  # api_endpoint = 'https://api-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
         | 
| 90 92 | 
             
                  api_endpoint = opts[:api_endpoint] if opts[:api_endpoint]
         | 
| 91 93 |  | 
| 92 94 | 
             
                  http_method = if opts[:http_method].nil?
         | 
| @@ -244,10 +246,12 @@ module Cryptum | |
| 244 246 | 
             
                  product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
         | 
| 245 247 |  | 
| 246 248 | 
             
                  this_product = event_history.order_book[:this_product]
         | 
| 247 | 
            -
                  base_min_size = this_product[:base_min_size]
         | 
| 249 | 
            +
                  # base_min_size = this_product[:base_min_size]
         | 
| 250 | 
            +
                  min_market_funds = this_product[:min_market_funds]
         | 
| 248 251 | 
             
                  base_increment = this_product[:base_increment]
         | 
| 249 252 | 
             
                  quote_increment = this_product[:quote_increment]
         | 
| 250 | 
            -
                  crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
         | 
| 253 | 
            +
                  # crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
         | 
| 254 | 
            +
                  crypto_smallest_size_to_buy = min_market_funds.to_s.split('.')[-1].length
         | 
| 251 255 | 
             
                  crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
         | 
| 252 256 | 
             
                  fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
         | 
| 253 257 |  | 
| @@ -327,10 +331,12 @@ module Cryptum | |
| 327 331 | 
             
                  product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
         | 
| 328 332 |  | 
| 329 333 | 
             
                  this_product = event_history.order_book[:this_product]
         | 
| 330 | 
            -
                  base_min_size = this_product[:base_min_size]
         | 
| 334 | 
            +
                  # base_min_size = this_product[:base_min_size]
         | 
| 335 | 
            +
                  min_market_funds = this_product[:min_market_funds]
         | 
| 331 336 | 
             
                  base_increment = this_product[:base_increment]
         | 
| 332 337 | 
             
                  quote_increment = this_product[:quote_increment]
         | 
| 333 | 
            -
                  crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
         | 
| 338 | 
            +
                  # crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
         | 
| 339 | 
            +
                  crypto_smallest_size_to_buy = min_market_funds.to_s.split('.')[-1].length
         | 
| 334 340 | 
             
                  crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
         | 
| 335 341 | 
             
                  fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
         | 
| 336 342 |  | 
    
        data/lib/cryptum/event/buy.rb
    CHANGED
    
    | @@ -19,7 +19,8 @@ module Cryptum | |
| 19 19 | 
             
                    fiat_portfolio_file = opts[:fiat_portfolio_file]
         | 
| 20 20 | 
             
                    order_history = opts[:order_history]
         | 
| 21 21 | 
             
                    crypto_smallest_decimal = opts[:crypto_smallest_decimal]
         | 
| 22 | 
            -
                    base_min_size = opts[:base_min_size]
         | 
| 22 | 
            +
                    # base_min_size = opts[:base_min_size]
         | 
| 23 | 
            +
                    min_market_funds = this_product[:min_market_funds]
         | 
| 23 24 | 
             
                    indicator_status = opts[:indicator_status]
         | 
| 24 25 |  | 
| 25 26 | 
             
                    # Initialize some bot_conf variables
         | 
| @@ -103,13 +104,13 @@ module Cryptum | |
| 103 104 | 
             
                      calc_fiat_to_buy - total_limit_buy_orders_open_size
         | 
| 104 105 | 
             
                    )
         | 
| 105 106 |  | 
| 106 | 
            -
                    if  | 
| 107 | 
            +
                    if min_market_funds.to_i >= 1
         | 
| 107 108 | 
             
                      size = (
         | 
| 108 | 
            -
                        (calc_fiat_to_buy - total_limit_buy_orders_open_size).to_i -  | 
| 109 | 
            +
                        (calc_fiat_to_buy - total_limit_buy_orders_open_size).to_i - min_market_funds.to_i
         | 
| 109 110 | 
             
                      ).to_s
         | 
| 110 111 | 
             
                    end
         | 
| 111 112 |  | 
| 112 | 
            -
                    if size.to_f >=  | 
| 113 | 
            +
                    if size.to_f >= min_market_funds.to_f &&
         | 
| 113 114 | 
             
                       total_limit_buy_order_open_tot.zero? &&
         | 
| 114 115 | 
             
                       price.to_f.positive?
         | 
| 115 116 | 
             
                      # SUBMIT BUY ORDER
         | 
    
        data/lib/cryptum/event/sell.rb
    CHANGED
    
    | @@ -18,7 +18,8 @@ module Cryptum | |
| 18 18 | 
             
                    order_type = opts[:order_type]
         | 
| 19 19 | 
             
                    fiat_smallest_decimal = opts[:fiat_smallest_decimal]
         | 
| 20 20 | 
             
                    crypto_smallest_decimal = opts[:crypto_smallest_decimal]
         | 
| 21 | 
            -
                    base_min_size = opts[:base_min_size]
         | 
| 21 | 
            +
                    # base_min_size = opts[:base_min_size]
         | 
| 22 | 
            +
                    min_market_funds = this_product[:min_market_funds]
         | 
| 22 23 | 
             
                    indicator_status = opts[:indicator_status]
         | 
| 23 24 | 
             
                    quote_increment = opts[:quote_increment]
         | 
| 24 25 |  | 
| @@ -83,9 +84,9 @@ module Cryptum | |
| 83 84 | 
             
                      symbol_balance_available.floor(crypto_smallest_decimal)
         | 
| 84 85 | 
             
                    )
         | 
| 85 86 |  | 
| 86 | 
            -
                    size = symbol_balance_available if  | 
| 87 | 
            +
                    size = symbol_balance_available if min_market_funds.to_i == 1
         | 
| 87 88 |  | 
| 88 | 
            -
                    if size.to_f >=  | 
| 89 | 
            +
                    if size.to_f >= min_market_funds.to_f &&
         | 
| 89 90 | 
             
                       price.to_f.positive?
         | 
| 90 91 |  | 
| 91 92 | 
             
                      # SUBMIT SELL ORDER
         | 
| @@ -29,10 +29,12 @@ module Cryptum | |
| 29 29 | 
             
                    ticker_price = event_history.order_book[:ticker_price].to_f
         | 
| 30 30 | 
             
                    open_24h = event_history.order_book[:open_24h].to_f
         | 
| 31 31 | 
             
                    this_product = event_history.order_book[:this_product]
         | 
| 32 | 
            -
                    base_min_size = this_product[:base_min_size]
         | 
| 32 | 
            +
                    # base_min_size = this_product[:base_min_size]
         | 
| 33 | 
            +
                    min_market_funds = this_product[:min_market_funds]
         | 
| 33 34 | 
             
                    base_increment = this_product[:base_increment]
         | 
| 34 35 | 
             
                    quote_increment = this_product[:quote_increment]
         | 
| 35 | 
            -
                    crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
         | 
| 36 | 
            +
                    # crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
         | 
| 37 | 
            +
                    crypto_smallest_size_to_buy = min_market_funds.to_s.split('.')[-1].length
         | 
| 36 38 | 
             
                    crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
         | 
| 37 39 | 
             
                    fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
         | 
| 38 40 |  | 
| @@ -94,9 +96,11 @@ module Cryptum | |
| 94 96 | 
             
                            this_order[:invest].to_f / limit_price
         | 
| 95 97 | 
             
                          )
         | 
| 96 98 |  | 
| 97 | 
            -
                          size = size.to_i.floor if base_increment.to_i >= 1
         | 
| 99 | 
            +
                          # size = size.to_i.floor if base_increment.to_i >= 1
         | 
| 100 | 
            +
                          size = size.to_i.floor if min_market_funds.to_i >= 1
         | 
| 98 101 |  | 
| 99 | 
            -
                          size = base_min_size if size.to_f < base_min_size.to_f
         | 
| 102 | 
            +
                          # size = base_min_size if size.to_f < base_min_size.to_f
         | 
| 103 | 
            +
                          size = min_market_funds if size.to_f < min_market_funds.to_f
         | 
| 100 104 |  | 
| 101 105 | 
             
                          fiat_invested_this_order = size.to_f * price.to_f
         | 
| 102 106 |  | 
| @@ -28,7 +28,8 @@ module Cryptum | |
| 28 28 | 
             
                    symbol_out = this_product[:id]
         | 
| 29 29 | 
             
                    quote_increment = this_product[:quote_increment]
         | 
| 30 30 | 
             
                    base_increment = this_product[:base_increment]
         | 
| 31 | 
            -
                    base_min_size = this_product[:base_min_size].to_f
         | 
| 31 | 
            +
                    # base_min_size = this_product[:base_min_size].to_f
         | 
| 32 | 
            +
                    min_market_funds = this_product[:min_market_funds]
         | 
| 32 33 |  | 
| 33 34 | 
             
                    fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
         | 
| 34 35 | 
             
                    crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
         | 
| @@ -104,9 +105,8 @@ module Cryptum | |
| 104 105 | 
             
                        # Calculate min order size
         | 
| 105 106 | 
             
                        allocation_decimal += 0.0001
         | 
| 106 107 | 
             
                        fiat_investing = risk_alloc * allocation_decimal
         | 
| 107 | 
            -
                        min_fiat_allowed_to_invest =  base_min_size * ticker_price
         | 
| 108 108 |  | 
| 109 | 
            -
                        next unless fiat_investing >=  | 
| 109 | 
            +
                        next unless fiat_investing >= min_market_funds.to_f
         | 
| 110 110 |  | 
| 111 111 | 
             
                        risk_alloc = fiat_budget * autotrade_cast_as_decimal
         | 
| 112 112 | 
             
                        allocation_percent = allocation_decimal * 100
         | 
    
        data/lib/cryptum/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cryptum
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.242
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - 0day Inc.
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022- | 
| 11 | 
            +
            date: 2022-07-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: addressable
         | 
| @@ -30,14 +30,14 @@ dependencies: | |
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - ">="
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: 2.3. | 
| 33 | 
            +
                    version: 2.3.17
         | 
| 34 34 | 
             
              type: :development
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - ">="
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: 2.3. | 
| 40 | 
            +
                    version: 2.3.17
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: bundler-audit
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -212,14 +212,14 @@ dependencies: | |
| 212 212 | 
             
                requirements:
         | 
| 213 213 | 
             
                - - '='
         | 
| 214 214 | 
             
                  - !ruby/object:Gem::Version
         | 
| 215 | 
            -
                    version: 1. | 
| 215 | 
            +
                    version: 1.31.1
         | 
| 216 216 | 
             
              type: :runtime
         | 
| 217 217 | 
             
              prerelease: false
         | 
| 218 218 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 219 219 | 
             
                requirements:
         | 
| 220 220 | 
             
                - - '='
         | 
| 221 221 | 
             
                  - !ruby/object:Gem::Version
         | 
| 222 | 
            -
                    version: 1. | 
| 222 | 
            +
                    version: 1.31.1
         | 
| 223 223 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 224 224 | 
             
              name: rubocop-rake
         | 
| 225 225 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -240,14 +240,14 @@ dependencies: | |
| 240 240 | 
             
                requirements:
         | 
| 241 241 | 
             
                - - '='
         | 
| 242 242 | 
             
                  - !ruby/object:Gem::Version
         | 
| 243 | 
            -
                    version: 2. | 
| 243 | 
            +
                    version: 2.12.1
         | 
| 244 244 | 
             
              type: :runtime
         | 
| 245 245 | 
             
              prerelease: false
         | 
| 246 246 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 247 247 | 
             
                requirements:
         | 
| 248 248 | 
             
                - - '='
         | 
| 249 249 | 
             
                  - !ruby/object:Gem::Version
         | 
| 250 | 
            -
                    version: 2. | 
| 250 | 
            +
                    version: 2.12.1
         | 
| 251 251 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 252 252 | 
             
              name: ruby-prof
         | 
| 253 253 | 
             
              requirement: !ruby/object:Gem::Requirement
         |