coss_bot 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +4 -4
- data/README.md +2 -2
- data/coss_bot.gemspec +1 -1
- data/lib/coss_bot/basic.rb +5 -3
- data/lib/coss_bot/buy_low_sell_high.rb +3 -4
- data/lib/coss_bot/version.rb +1 -1
- data/lib/coss_bot.rb +1 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c85e32211ac8fd1a7c3d1f8baafeba6a841423b868a3fb98e4ed91fae93aeb00
|
4
|
+
data.tar.gz: 1afa1f2048c150ecb1e84fa535627a2068bc86a8d16368b62db55190cad07d70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f2bc2c5727d184947560a6f2410266e82e38b81a39fdd5255547ea3fe07245f0bff95dc7aaa0c0e5a73cbec92c455c8b619b9ea41cb7d786426c7017ab6e8d5
|
7
|
+
data.tar.gz: ab694d3a8b7296621a4672efa6c1a0e193b797b57cd7b1bb02ef933ce450f7860d6708e3dec4eda9c3191b05d2bf0229ac86427ec001c2a3a67e0c19affc4325
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
coss_bot (0.1.
|
5
|
-
coss_api_ruby_wrapper (
|
4
|
+
coss_bot (0.1.1)
|
5
|
+
coss_api_ruby_wrapper (= 0.1.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
coss_api_ruby_wrapper (0.1.
|
10
|
+
coss_api_ruby_wrapper (0.1.1)
|
11
11
|
diff-lcs (1.3)
|
12
12
|
rake (10.5.0)
|
13
13
|
rspec (3.8.0)
|
@@ -29,7 +29,7 @@ PLATFORMS
|
|
29
29
|
|
30
30
|
DEPENDENCIES
|
31
31
|
bundler (~> 1.17)
|
32
|
-
coss_api_ruby_wrapper (
|
32
|
+
coss_api_ruby_wrapper (= 0.1.1)
|
33
33
|
coss_bot!
|
34
34
|
rake (~> 10.0)
|
35
35
|
rspec (~> 3.0)
|
data/README.md
CHANGED
@@ -27,8 +27,8 @@ bot.lot_size = 10 # 10 coss tokens will be bought/sold
|
|
27
27
|
bot.profit = 0.1 # SELL order will be 0.1% higher than BUY order
|
28
28
|
bot.pair = 'COSS_ETH' # Bot will work on COSS_ETH pair, buying COSS for ETH
|
29
29
|
bot.trade_limit = 0.01 # trading cycle does not start if ETH limit is less than 0.1 ETH (ETH is chosen because it is a base pair in this case. If it would be BTC_USDT - it would be USDT)
|
30
|
-
bot.call do |
|
31
|
-
puts "
|
30
|
+
bot.call do |buy_order_id, sell_order_id|
|
31
|
+
puts "BUY order id: #{buy_order_id}; SELL order id: #{sell_order_id}" # You can pass block to save order ids.
|
32
32
|
end
|
33
33
|
|
34
34
|
```
|
data/coss_bot.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
|
-
spec.add_dependency 'coss_api_ruby_wrapper', '
|
26
|
+
spec.add_dependency 'coss_api_ruby_wrapper', '0.1.1'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler', '~> 1.17'
|
29
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/lib/coss_bot/basic.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module CossBot
|
2
4
|
class Basic
|
3
5
|
attr_reader :exchange
|
@@ -10,8 +12,9 @@ module CossBot
|
|
10
12
|
def call(&block)
|
11
13
|
validate_params!
|
12
14
|
loop do
|
13
|
-
tick(&block)
|
14
|
-
|
15
|
+
time = Benchmark.measure { tick(&block) }.real
|
16
|
+
wait_time = time > interval ? 0 : interval - time
|
17
|
+
sleep(wait_time)
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
@@ -26,6 +29,5 @@ module CossBot
|
|
26
29
|
|
27
30
|
raise ArgumentError, 'Some params are invalid'
|
28
31
|
end
|
29
|
-
|
30
32
|
end
|
31
33
|
end
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
module CossBot
|
4
4
|
class BuyLowSellHigh < Basic
|
5
|
-
|
6
5
|
private
|
7
6
|
|
8
7
|
def tick
|
@@ -17,10 +16,10 @@ module CossBot
|
|
17
16
|
|
18
17
|
price_with_profit = (current_price + (current_price / 100 * profit)).round(6)
|
19
18
|
puts "Placing BUY order for #{current_price}. Lot size: #{lot_size}"
|
20
|
-
exchange.place_limit_order(pair, current_price, 'BUY', lot_size)
|
19
|
+
buy_response = exchange.place_limit_order(pair, current_price, 'BUY', lot_size)
|
21
20
|
puts "Placing SELL order for #{price_with_profit}. Lot size: #{lot_size}"
|
22
|
-
exchange.place_limit_order(pair, price_with_profit, 'SELL', lot_size)
|
23
|
-
yield(
|
21
|
+
sell_response = exchange.place_limit_order(pair, price_with_profit, 'SELL', lot_size)
|
22
|
+
yield(buy_response['order_id'], sell_response['order_id'])
|
24
23
|
puts '=== End of trading cycle ==='
|
25
24
|
end
|
26
25
|
end
|
data/lib/coss_bot/version.rb
CHANGED
data/lib/coss_bot.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coss_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktor Vsk
|
@@ -14,16 +14,16 @@ dependencies:
|
|
14
14
|
name: coss_api_ruby_wrapper
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|