Class: Cryptoexchange::Exchanges::Jex::Services::Pairs
Constant Summary
collapse
- PAIRS_URL =
"#{Cryptoexchange::Exchanges::Jex::Market::API_URL}"
Services::Pairs::HTTP_METHOD, Services::Pairs::MARKET, Services::Pairs::POST_PARAMS
Instance Method Summary
collapse
#default_override_exist?, #default_override_path, #exchange_class, #fetch_via_api, #fetch_via_api_using_post, #fetch_via_override, #http_get, #http_post, #user_override_exist?, #user_override_path
Instance Method Details
#adapt(output) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/cryptoexchange/exchanges/jex/services/pairs.rb', line 12
def adapt(output)
market_pairs = []
output.map do |pair, ticker|
if !derivative(pair)
base, target = pair.split('/')
market_pairs << Cryptoexchange::Models::MarketPair.new(
base: base.upcase,
target: target.upcase,
market: Jex::Market::NAME
)
end
end
market_pairs
end
|
#derivative(pair) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/cryptoexchange/exchanges/jex/services/pairs.rb', line 27
def derivative(pair)
etf = /(ETF)/ =~ pair
option = /(PUT|CALL)/ =~ pair
if etf && !pair.include?("/")
true
elsif option && pair.count("/") > 1
true
elsif option
true
else
false
end
end
|
#fetch ⇒ Object
7
8
9
10
|
# File 'lib/cryptoexchange/exchanges/jex/services/pairs.rb', line 7
def fetch
output = super
adapt(output)
end
|