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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 005f1f208751ae001556e291e74d8e542e14b6b5
4
- data.tar.gz: 46fa73fdcf2b7e8d4f36f7da168924564cbe5c60
3
+ metadata.gz: eda18679f050caa9b7644275f294eeb7520eafc5
4
+ data.tar.gz: ab57d1b7f56b135a4e57816214b7571d05294c1c
5
5
  SHA512:
6
- metadata.gz: eb15acdbf17f10725289d9fd396aa8548853dd82b40a06090af096e753d069f2789f336ef82f393f4a4b13951b06691c4e0f996987b0e7c26e0a173b370ceead
7
- data.tar.gz: a0a3c17cc484157f61e68d3e13a3d9f325d3664a4900c7f7fcad186db90b5c49cfd44ff831864a0c1733eed524167c107d6553f734dc1bad8c5b942c8b595ea5
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(:BITFINEX_USD)
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
- type: "exchange limit"
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
 
@@ -4,7 +4,7 @@ require 'json'
4
4
  module Trader
5
5
  class BitstampBackend < BaseBackend
6
6
  BASE_CUR = Currency.for_code(:BTC)
7
- QUOTE_CUR = Currency.for_code(:BITSTAMP_USD)
7
+ QUOTE_CUR = Currency.for_code(:USD)
8
8
  MAIN_MARKET = CurrencyPair.new BASE_CUR, QUOTE_CUR
9
9
 
10
10
  TYPE_MAP = {
@@ -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 == :Bitstamp_USD
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, :SURBTC_CLP)
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 == :SURBTC_CLP
115
+ return 'clp' if _currency.code == :CLP
116
116
  return 'btc' if _currency.code == :SATOSHI
117
117
  _currency.to_s.downcase
118
118
  end
@@ -1,3 +1,3 @@
1
1
  module Trader
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  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.1
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 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client