trade-o-matic 0.5.1 → 0.5.2

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: 7c607409f48a8ebefcd4e4401075b8a5e07ec3e6
4
- data.tar.gz: a2c460a7171a03141b062ad2b0f15b51221f288b
3
+ metadata.gz: cdb3595eea3330dbf40ed1afd20fb8348bb8bb4d
4
+ data.tar.gz: 78a9ef0e573e675b114c32d080919d6b5e8757c8
5
5
  SHA512:
6
- metadata.gz: 912578b54ec8d32d142bd60f4aa4c4193233f637caa9bfa40cc048f6af228d09a59413e8979530eb659af3727c7c0226437eecd90f0c799e7d544d4eb65c6b46
7
- data.tar.gz: 056feaf52b17a1530e61f7410d62656a3f9392769f71f39f71273659e9cca68d1f363ad13e9b52290512f1739a3985aad5425c5f759278520443ddb525db695f
6
+ metadata.gz: bc904cab00433f2d3976d980c2bbd2faccf79912e72f5e9ed1e7d23bf58c0bddd17e6e978994b640e60313cc41755ace6d94d8244cd1ca2a999d4842bc293f4b
7
+ data.tar.gz: 7ecfa279fa0a9b8394d361f43f0c22a28653fa8aae669e60b011fda220f0d6fd1948d0281cea65102642cac232e5d2351ca1dce963970a47d8c2677b00959fca
@@ -85,14 +85,22 @@ module Trader
85
85
  end
86
86
 
87
87
  def create_order(_session, _pair, _volume, _price, _type)
88
- wrap_order auth_post(_session, 'order/new', {
88
+ params = {
89
89
  exchange: "bitfinex",
90
90
  symbol: "BTCUSD",
91
91
  side: _type == Order::BID ? 'buy' : 'sell',
92
- amount: _volume.to_s('F'),
93
- price: (_price.nil? ? nil : _price.to_s('F')),
94
- type: (_price.nil? ? "exchange market" : "exchange limit")
95
- })
92
+ amount: _volume.to_s('F')
93
+ }
94
+
95
+ if _price.nil?
96
+ params[:price] = _type == Order::BID ? '1.0' : '1000000.0' # some safe values just in case
97
+ params[:type] = 'exchange market'
98
+ else
99
+ params[:price] = _price.to_s('F')
100
+ params[:type] = 'exchange limit'
101
+ end
102
+
103
+ wrap_order auth_post(_session, 'order/new', params)
96
104
  end
97
105
 
98
106
  def fetch_order(_session, _id)
@@ -1,3 +1,3 @@
1
1
  module Trader
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trade-o-matic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignacio Baixas