trade-o-matic 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trade-o-matic/adapters/bitfinex_backend.rb +5 -5
- data/lib/trade-o-matic/adapters/bitstamp_backend.rb +1 -1
- data/lib/trade-o-matic/adapters/itbit_backend.rb +1 -1
- data/lib/trade-o-matic/adapters/surbtc_backend.rb +2 -2
- data/lib/trade-o-matic/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eda18679f050caa9b7644275f294eeb7520eafc5
|
4
|
+
data.tar.gz: ab57d1b7f56b135a4e57816214b7571d05294c1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db9c47ab9f04ab0849cf0e9d546f44ff6e848331462cfde2112c42e8eb3536bed1ed6ae55d57edd018fff053dcf8047c35653a2547fe41de5544b1492af912bd
|
7
|
+
data.tar.gz: b9ffc503e782e8cb61be71a770d0a21b65b7a0c2c673903314ea20fb556277e8bd05322a2edd30c431093b877fc47c964e3479c553ccbade46b3597f20fe5dfa
|
@@ -5,7 +5,7 @@ require 'json'
|
|
5
5
|
module Trader
|
6
6
|
class BitfinexBackend < BaseBackend
|
7
7
|
BASE_CUR = Currency.for_code(:BTC)
|
8
|
-
QUOTE_CUR = Currency.for_code(:
|
8
|
+
QUOTE_CUR = Currency.for_code(:USD)
|
9
9
|
MAIN_MARKET = CurrencyPair.new BASE_CUR, QUOTE_CUR
|
10
10
|
|
11
11
|
CUR_EQUIV = {
|
@@ -21,7 +21,7 @@ module Trader
|
|
21
21
|
class OrderAdaptor < RawAccountOrder
|
22
22
|
attr_mapped(:id)
|
23
23
|
attr_mapped(:pair) { |r| MAIN_MARKET }
|
24
|
-
attr_mapped(:price)
|
24
|
+
attr_mapped(:price) { |r| r['type'] == 'exchange market' ? nil : r['price'] }
|
25
25
|
attr_mapped(:volume, 'original_amount')
|
26
26
|
attr_mapped(:executed_volume, 'executed_amount')
|
27
27
|
attr_mapped(:instruction) { |r| r['side'] == 'buy' ? Order::BID : Order::ASK }
|
@@ -90,10 +90,10 @@ module Trader
|
|
90
90
|
wrap_order auth_post(_session, 'order/new', {
|
91
91
|
exchange: "bitfinex",
|
92
92
|
symbol: "BTCUSD",
|
93
|
-
amount: _volume.to_s('F'),
|
94
|
-
price: _price.to_s('F'),
|
95
93
|
side: _type == Order::BID ? 'buy' : 'sell',
|
96
|
-
|
94
|
+
amount: _volume.to_s('F'),
|
95
|
+
price: (_price.nil? ? nil : _price.to_s('F')),
|
96
|
+
type: (_price.nil? ? "exchange market" : "exchange limit")
|
97
97
|
})
|
98
98
|
end
|
99
99
|
|
@@ -29,7 +29,7 @@ module Trader
|
|
29
29
|
|
30
30
|
def get_balance(_session, _currency)
|
31
31
|
return Price.new(_currency, 0.0) if _currency.code == :BTC
|
32
|
-
return Price.new(_currency, 20000.0) if _currency.code == :
|
32
|
+
return Price.new(_currency, 20000.0) if _currency.code == :USD
|
33
33
|
end
|
34
34
|
|
35
35
|
def get_orders(_session, _pair)
|
@@ -18,7 +18,7 @@ module Trader
|
|
18
18
|
'canceled' => AccountOrder::CANCELED
|
19
19
|
}
|
20
20
|
|
21
|
-
MAIN_MARKET = CurrencyPair.new(:SATOSHI, :
|
21
|
+
MAIN_MARKET = CurrencyPair.new(:SATOSHI, :CLP)
|
22
22
|
|
23
23
|
class SurbtcBalance < RawBalance
|
24
24
|
attr_mapped :amount
|
@@ -112,7 +112,7 @@ module Trader
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def currency_code_for(_currency)
|
115
|
-
return 'clp' if _currency.code == :
|
115
|
+
return 'clp' if _currency.code == :CLP
|
116
116
|
return 'btc' if _currency.code == :SATOSHI
|
117
117
|
_currency.to_s.downcase
|
118
118
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trade-o-matic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ignacio Baixas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|