bittrader-bot 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/bittrader-bot +31 -0
- data/lib/bittrader-bot.rb +126 -0
- data/lib/bittrader-bot/bot_logic.rb +77 -0
- data/lib/bittrader-bot/coinmarketcap.rb +41 -0
- data/lib/bittrader-bot/exchange_interface.rb +32 -0
- data/lib/bittrader-bot/namespace.rb +26 -0
- data/lib/bittrader-bot/poloniex.rb +177 -0
- data/test/test_bot_logic.rb +41 -0
- metadata +54 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5dde23b9eebb480b78a4a0da149fb8e7eab17381
|
4
|
+
data.tar.gz: a2d4471efbdde6f902d528a55d48d04283bc9290
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 15413052b5db609311955af51b0965b740b91bfcf31b089826f93f5fc5ea304f0a211e0d44e90be2be4e56c17b6b1bcce522b7de1e05fb2a33bf2549f8318ee7
|
7
|
+
data.tar.gz: 9dc2d788b9b7b7ec3acfb6bd1ecef0c9bfc27e3d3d97a89e19defa4b951e281b6c42bb411e5ecf73d1e1753d0fb694b585f999d00d2a8814738223cc239aab67
|
data/bin/bittrader-bot
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby'
|
2
|
+
# Copyright 2017 Richard Davis
|
3
|
+
#
|
4
|
+
# This file is part of bittrader-bot.
|
5
|
+
#
|
6
|
+
# bittrader-bot is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# bittrader-bot is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with bittrader-bot. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
##
|
20
|
+
# = /bin/bittrader-bot
|
21
|
+
# Author:: Richard Davis
|
22
|
+
# Copyright:: Copyright 2017 Richard Davis
|
23
|
+
# License:: GNU Public License 3
|
24
|
+
#
|
25
|
+
# Project executable file.
|
26
|
+
begin
|
27
|
+
require 'bittrader-bot'
|
28
|
+
rescue LoadError
|
29
|
+
require 'rubygems'
|
30
|
+
require 'bittrader-bot'
|
31
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
# Copyright 2017 Richard Davis
|
2
|
+
#
|
3
|
+
# This file is part of bittrader-bot.
|
4
|
+
#
|
5
|
+
# bittrader-bot is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# bittrader-bot is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with bittrader-bot. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
##
|
19
|
+
# = /lib/bittrader-bot.rb
|
20
|
+
# Author:: Richard Davis
|
21
|
+
# Copyright:: Copyright 2017 Richard Davis
|
22
|
+
# License:: GNU Public License 3
|
23
|
+
#
|
24
|
+
# Main application file that loads other files.
|
25
|
+
require 'bittrader-bot/bot_logic'
|
26
|
+
require 'bittrader-bot/namespace'
|
27
|
+
require 'bittrader-bot/coinmarketcap'
|
28
|
+
require 'bittrader-bot/exchange_interface'
|
29
|
+
require 'bittrader-bot/poloniex'
|
30
|
+
|
31
|
+
require 'optparse'
|
32
|
+
|
33
|
+
require 'telegram/bot'
|
34
|
+
|
35
|
+
trap('INT') do
|
36
|
+
puts "\nTerminating..."
|
37
|
+
exit
|
38
|
+
end
|
39
|
+
|
40
|
+
options = {}
|
41
|
+
|
42
|
+
optparse = OptionParser.new do |opts|
|
43
|
+
opts.banner = 'Usage: bittrader-bot [options]'
|
44
|
+
|
45
|
+
opts.on('-e', '--execute FILE', 'Launches the bot with the specified configuration file.') do |file|
|
46
|
+
options[:execute] = true
|
47
|
+
options[:file] = file
|
48
|
+
end
|
49
|
+
|
50
|
+
opts.on('-l', '--license', 'Displays the copyright notice') do
|
51
|
+
puts "This program is free software: you can redistribute it and/or modify
|
52
|
+
it under the terms of the GNU General Public License as published by
|
53
|
+
the Free Software Foundation, either version 3 of the License, or
|
54
|
+
(at your option) any later version.
|
55
|
+
"
|
56
|
+
end
|
57
|
+
|
58
|
+
opts.on('-w', '--warranty', 'Displays the warranty statement') do
|
59
|
+
puts "This program is distributed in the hope that it will be useful,
|
60
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
61
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
62
|
+
GNU General Public License for more details.
|
63
|
+
"
|
64
|
+
end
|
65
|
+
|
66
|
+
opts.on_tail('-h', '--help', 'Displays the help screen') do
|
67
|
+
puts opts
|
68
|
+
exit
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
optparse.parse!
|
73
|
+
|
74
|
+
##
|
75
|
+
# Launches bot with values read from config file
|
76
|
+
def start_bot config
|
77
|
+
puts 'Loading configuration file...'
|
78
|
+
file = File.read(config)
|
79
|
+
config = JSON.parse file
|
80
|
+
@bot = BittraderBot::BotLogic.new(config.to_h)
|
81
|
+
puts 'Bittrader-Bot initialized.'
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Queries CoinMarketCap's API for a coin's current value in BTC and USD
|
86
|
+
def query_coin_price coin
|
87
|
+
data = BittraderBot::CoinMarketCap.ticker_by_currency(coin)
|
88
|
+
response = @bot.send_get_request(data[0], data[1])
|
89
|
+
response_json = JSON.parse(response.body)
|
90
|
+
coin_data = response_json[0].to_h
|
91
|
+
"The price of #{coin} is currently #{coin_data['price_btc']} BTC (#{coin_data['price_usd']} USD)"
|
92
|
+
end
|
93
|
+
|
94
|
+
def on regex, message, &block
|
95
|
+
regex =~ message.text
|
96
|
+
|
97
|
+
if $~
|
98
|
+
case block.arity
|
99
|
+
when 0
|
100
|
+
yield
|
101
|
+
when 1
|
102
|
+
yield $1
|
103
|
+
when 2
|
104
|
+
yield $1, $2
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
if options[:execute]
|
110
|
+
start_bot options[:file]
|
111
|
+
Telegram::Bot::Client.run(@bot.telegram_token) do |bot|
|
112
|
+
bot.listen do |message|
|
113
|
+
on (/^\/start/), message do
|
114
|
+
bot.api.send_message(chat_id: message.chat.id, text: "Hello, #{message.from.first_name}")
|
115
|
+
end
|
116
|
+
|
117
|
+
on (/^\/check (.+)/), message do |arg|
|
118
|
+
bot.api.send_message(chat_id: message.chat.id, text: "#{query_coin_price arg}")
|
119
|
+
end
|
120
|
+
|
121
|
+
on (/^\/stop/), message do
|
122
|
+
bot.api.send_message(chat_id: message.chat.id, text: "Bye, #{message.from.first_name}")
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright 2017 Richard Davis
|
2
|
+
#
|
3
|
+
# This file is part of bittrader-bot.
|
4
|
+
#
|
5
|
+
# bittrader-bot is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# bittrader-bot is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with bittrader-bot. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
require 'uri'
|
19
|
+
require 'net/http'
|
20
|
+
require 'net/https'
|
21
|
+
require 'json'
|
22
|
+
|
23
|
+
##
|
24
|
+
# = BotLogic
|
25
|
+
# Author:: Richard Davis
|
26
|
+
# Copyright:: Copyright 2017 Richard Davis
|
27
|
+
# License:: GNU Public License 3
|
28
|
+
#
|
29
|
+
# Provides object for basic bot behavior over HTTP
|
30
|
+
module BittraderBot
|
31
|
+
class BotLogic
|
32
|
+
attr_reader :exchange, :telegram_token, :key, :secret
|
33
|
+
|
34
|
+
##
|
35
|
+
# Initializes a BotLogic object
|
36
|
+
def initialize config
|
37
|
+
@exchange = config['exchange']
|
38
|
+
@telegram_token = config['telegram_token']
|
39
|
+
@key = config['key']
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Starts the connection to the server and provides identification
|
44
|
+
def start_connection host
|
45
|
+
uri = URI.parse(host)
|
46
|
+
https = Net::HTTP.new(uri.host, 443)
|
47
|
+
https.use_ssl = true
|
48
|
+
return https
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Send GET request to exchange
|
53
|
+
def send_get_request host, request
|
54
|
+
https = start_connection host
|
55
|
+
req = Net::HTTP::Get.new(request)
|
56
|
+
https.request(req)
|
57
|
+
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# Sends POST request to exchange
|
61
|
+
def send_post_request data
|
62
|
+
request = Net::HTTP::Post.new(uri.path, initheader: {'Content-Type' =>'application/json'})
|
63
|
+
request['key'] = @key
|
64
|
+
request['sign'] = sign_post_data(data.to_json)
|
65
|
+
request.body = data.to_json
|
66
|
+
response = https.request(request)
|
67
|
+
puts "Response #{response.code} #{response.message}: #{response.body}"
|
68
|
+
end
|
69
|
+
|
70
|
+
##
|
71
|
+
# Signs POST data using HMAC-SHA512 method
|
72
|
+
def sign_post_data data
|
73
|
+
digest = OpenSSL::Digest.new('sha512')
|
74
|
+
OpenSSL::HMAC.digest(digest, @secret, data)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright 2017 Richard Davis
|
2
|
+
#
|
3
|
+
# This file is part of bittrader-bot.
|
4
|
+
#
|
5
|
+
# bittrader-bot is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# bittrader-bot is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with bittrader-bot. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
module BittraderBot
|
19
|
+
##
|
20
|
+
# = CoinMarketCap
|
21
|
+
# Author:: Richard Davis
|
22
|
+
# Copyright:: Copyright 2017 Richard Davis
|
23
|
+
# License:: GNU Public License 3
|
24
|
+
#
|
25
|
+
# Holds methods for interacting with CoinMarketCap
|
26
|
+
module CoinMarketCap
|
27
|
+
@host = 'https://api.coinmarketcap.com/'
|
28
|
+
|
29
|
+
##
|
30
|
+
# Gets ticker information for a given currency
|
31
|
+
def self.ticker
|
32
|
+
return @host,'/v1/ticker/'
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Gets ticker information for a given currency
|
37
|
+
def self.ticker_by_currency currency
|
38
|
+
return @host, "/v1/ticker/#{currency}/"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Copyright 2017 Richard Davis
|
2
|
+
#
|
3
|
+
# This file is part of bittrader-bot.
|
4
|
+
#
|
5
|
+
# bittrader-bot is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# bittrader-bot is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with bittrader-bot. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
module BittraderBot
|
19
|
+
##
|
20
|
+
# = ExchangeInterface
|
21
|
+
# Author:: Richard Davis
|
22
|
+
# Copyright:: Copyright 2017 Richard Davis
|
23
|
+
# License:: GNU Public License 3
|
24
|
+
#
|
25
|
+
# Provides namespace for all exchange wrapper modules
|
26
|
+
module ExchangeInterface
|
27
|
+
def self.proc_request host, endpoint, params
|
28
|
+
params_str = params.map{|param, value| "#{param}=#{value}"}.join('&')
|
29
|
+
return host, "#{endpoint}?#{params_str}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright 2017 Richard Davis
|
2
|
+
#
|
3
|
+
# This file is part of bittrader-bot.
|
4
|
+
#
|
5
|
+
# bittrader-bot is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# bittrader-bot is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with bittrader-bot. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
##
|
19
|
+
# = BittraderBot
|
20
|
+
# Author:: Richard Davis
|
21
|
+
# Copyright:: Copyright 2017 Richard Davis
|
22
|
+
# License:: GNU Public License 3
|
23
|
+
#
|
24
|
+
# Top-level namespace for BittraderBot modules and classes
|
25
|
+
module BittraderBot
|
26
|
+
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
# Copyright 2017 Richard Davis
|
2
|
+
#
|
3
|
+
# This file is part of bittrader-bot.
|
4
|
+
#
|
5
|
+
# bittrader-bot is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# bittrader-bot is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with bittrader-bot. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
module BittraderBot
|
19
|
+
module ExchangeInterface
|
20
|
+
##
|
21
|
+
# = Poloniex
|
22
|
+
# Author:: Richard Davis
|
23
|
+
# Copyright:: Copyright 2017 Richard Davis
|
24
|
+
# License:: GNU Public License 3
|
25
|
+
#
|
26
|
+
# Holds methods for interacting with Poloniex Exchange
|
27
|
+
module Poloniex
|
28
|
+
@public_host = 'https://poloniex.com/'
|
29
|
+
|
30
|
+
##
|
31
|
+
# Returns ticker information
|
32
|
+
def self.return_ticker
|
33
|
+
endpoint = 'public'
|
34
|
+
params = {
|
35
|
+
command: 'returnTicker'
|
36
|
+
}
|
37
|
+
return @public_host, endpoint, params
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.return_24_volume
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.return_order_book
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.return_trade_history
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.return_chart_data
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.return_currencies
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.return_loan_orders
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.return_balances
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.return_complete_balances
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# Not implemented
|
66
|
+
def self.return_deposit_addresses
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# Not implemented
|
71
|
+
def self.generate_new_address
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Not implemented
|
76
|
+
def self.return_deposits_withdrawals
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.return_open_orders
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.return_trade_history
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.order_trades
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.buy
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.sell
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.cancel_order
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Not implemented
|
99
|
+
def self.move_order
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Not implemented
|
104
|
+
def self.withdraw
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.return_fee_info
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.return_available_account_balances
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.return_tradable_balances
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# Not implemented
|
118
|
+
def self.transfer_balance
|
119
|
+
end
|
120
|
+
|
121
|
+
##
|
122
|
+
# Not implemented
|
123
|
+
def self.return_margin_account_summary
|
124
|
+
end
|
125
|
+
|
126
|
+
##
|
127
|
+
# Not implemented
|
128
|
+
def self.margin_buy
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Not implemented
|
133
|
+
def self.margin_sell
|
134
|
+
end
|
135
|
+
|
136
|
+
##
|
137
|
+
# Not implemented
|
138
|
+
def self.get_margin_position
|
139
|
+
end
|
140
|
+
|
141
|
+
##
|
142
|
+
# Not implemented
|
143
|
+
def self.close_margin_position
|
144
|
+
end
|
145
|
+
|
146
|
+
##
|
147
|
+
# Not implemented
|
148
|
+
def self.create_loan_offer
|
149
|
+
end
|
150
|
+
|
151
|
+
##
|
152
|
+
# Not implemented
|
153
|
+
def self.cancel_loan_offer
|
154
|
+
end
|
155
|
+
|
156
|
+
##
|
157
|
+
# Not implemented
|
158
|
+
def self.return_open_loan_offers
|
159
|
+
end
|
160
|
+
|
161
|
+
##
|
162
|
+
# Not implemented
|
163
|
+
def self.return_active_loans
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# Not implemented
|
168
|
+
def self.return_lending_history
|
169
|
+
end
|
170
|
+
|
171
|
+
##
|
172
|
+
# Not implemented
|
173
|
+
def self.toggle_auto_renew
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright 2017 Richard Davis
|
2
|
+
#
|
3
|
+
# This file is part of bittrader-bot.
|
4
|
+
#
|
5
|
+
# bittrader-bot is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# bittrader-bot is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with bittrader-bot. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
require 'minitest/autorun'
|
19
|
+
require_relative '../lib/bittrader-bot/bot_logic'
|
20
|
+
|
21
|
+
##
|
22
|
+
# = BotLogicTest
|
23
|
+
# Author:: Richard Davis
|
24
|
+
# Copyright:: Copyright 2017 Richard Davis
|
25
|
+
# License:: GNU Public License 3
|
26
|
+
#
|
27
|
+
# Tests for Bittrader::BotLogic class
|
28
|
+
class BotLogicTest < Minitest::Test
|
29
|
+
##
|
30
|
+
# Initializes test with sample data
|
31
|
+
def setup
|
32
|
+
config = { telegram_token: 'example_token' }
|
33
|
+
@bot = BittraderBot::BotLogic.new(config)
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# Tests that telegram_token gets properly initialized
|
38
|
+
def test_telegram_token
|
39
|
+
assert_equal('example_token', @bot.telegram_token)
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bittrader-bot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Davis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-12-25 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: " A cryptocurrency trading bot that interfaces with a given cryptocurrency
|
14
|
+
trading exchange and sends notifications of trades via Telegram.\n"
|
15
|
+
email: rvdavis@member.fsf.org
|
16
|
+
executables:
|
17
|
+
- bittrader-bot
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/bittrader-bot
|
22
|
+
- lib/bittrader-bot.rb
|
23
|
+
- lib/bittrader-bot/bot_logic.rb
|
24
|
+
- lib/bittrader-bot/coinmarketcap.rb
|
25
|
+
- lib/bittrader-bot/exchange_interface.rb
|
26
|
+
- lib/bittrader-bot/namespace.rb
|
27
|
+
- lib/bittrader-bot/poloniex.rb
|
28
|
+
- test/test_bot_logic.rb
|
29
|
+
homepage: https://github.com/d3d1rty/bittrader-bot
|
30
|
+
licenses:
|
31
|
+
- GPL-3.0
|
32
|
+
metadata: {}
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 2.6.11
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: A cryptocurrency trading bot.
|
53
|
+
test_files:
|
54
|
+
- test/test_bot_logic.rb
|