Sha256: c564bc80dac999b500b5308661b90f61d42dc9de7cf349e062066472347e61b0
Contents?: true
Size: 832 Bytes
Versions: 1
Compression:
Stored size: 832 Bytes
Contents
require 'rest-client' require 'date' require 'uri' require 'json' require 'binance_api/result' module BinanceAPI class Base BASE_URL = 'https://api.binance.com'.freeze protected def params_with_signature(params, secret) params = params.reject { |_k, v| v.nil? } query_string = URI.encode_www_form(params) signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), secret, query_string) params = params.merge(signature: signature) end # ensure to return a response object def safe yield rescue RestClient::ExceptionWithResponse => err return err.response end def config @config ||= BinanceAPI.load_config end def api_key config['API_KEY'].freeze end def api_secret config['API_SECRET'].freeze end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
binance_api-1.0.0 | lib/binance_api/base.rb |