poloniex.rb 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70ca0c1001793f40b8103c611757c292ab05107fad90e09b73c9e5af3c45385a
4
- data.tar.gz: 5ed27566cee231c459d813b9354cf576c29eec11e75fb374fb9c626339649bda
3
+ metadata.gz: b947fd07cc798d17972bfe2f482cd2f75dffbf5c26fdee98ce70e851bf1a1415
4
+ data.tar.gz: 27e4eb04f6fd550aa31d50b7e38ab20b17f3f9019c7e01f279cd6404663b7a80
5
5
  SHA512:
6
- metadata.gz: d5207457c2b9c8efc54531e70cc3345e51d61f80e7d7bfe1515bbaef2b74631b5501a041b6cf2df11de5f3b158baad3c20f50533575094dffaa16342164a9420
7
- data.tar.gz: '092dc1a453c77c1a13d2b6b993054b1d662b9404ce6a95197b6e83ffdec65cfa2fdd26d5c4004e27583e66fcaf0f448607af7c48513afdc970ec663b38401c95'
6
+ metadata.gz: f5eedd1104ca24edb35f3a6f91c724fc9c37cf8f6f7f520ceb8b2afa4ce7e2b7777ffe6ec70e5c692458879177d804689014b60c9e794be6e1d68be32c0128f2
7
+ data.tar.gz: f465259b0e560aa90cae6ade75d42b82466ab9ddc6a8502e31f6e763c308f49099de8822e5662d4db935cff98c92172141cf0129c306a962200f76c81d8ce4b1
data/Gemfile CHANGED
@@ -1,12 +1,11 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gem "http.rb"
3
+ gem 'http.rb'
4
4
 
5
5
  group :development, :test do
6
- gem "rake"
7
- gem "minitest"
8
- gem "minitest-spec-context"
9
- gem "vcr"
10
- gem "webmock"
6
+ gem 'rake'
7
+ gem 'minitest'
8
+ gem 'minitest-spec-context'
9
+ gem 'vcr'
10
+ gem 'webmock'
11
11
  end
12
-
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  A Ruby wrapper for the Poloniex cryptocurrency exchange API.
4
4
 
5
+
5
6
  ## Installation
6
7
 
7
8
  Add this line to your application's Gemfile:
@@ -22,6 +23,7 @@ Or install it yourself as:
22
23
  $ gem install poloniex.rb
23
24
  ```
24
25
 
26
+
25
27
  ## Usage
26
28
 
27
29
  ### Configuration
@@ -32,17 +34,28 @@ Poloniex.configure do |config|
32
34
  config.api_key = 'your_api_key'
33
35
  config.api_secret = 'your_api_secret'
34
36
  config.debug = false # nil by default; set to true for debugging output
37
+ config.logger = STDOUT # nil by default
35
38
  end
36
39
 
37
40
  # Or configure per client instance
38
41
  client = Poloniex::Client.new(
39
42
  api_key: 'your_api_key',
40
43
  api_secret: 'your_api_secret',
41
- debug: false # nil by default; set to true for debugging output
44
+ debug: false, # nil by default; set to true for debugging output
45
+ logger: STDOUT # nil by default
42
46
  )
47
+
48
+ # Or configure per client instance by passing in a configuration object
49
+ configuration = Poloniex::Configuration.new(
50
+ api_key: 'your_api_key',
51
+ api_secret: 'your_api_secret',
52
+ debug: false, # nil by default; set to true for debugging output
53
+ logger: STDOUT # nil by default
54
+ )
55
+ client = Poloniex::Client.new(configuration: configuration)
43
56
  ```
44
57
 
45
- ### Public API Endpoints
58
+ ### Public V1 API Endpoints
46
59
 
47
60
  ```ruby
48
61
  # Get candles for specific symbol
@@ -89,15 +102,148 @@ client.timestamp
89
102
 
90
103
  # Get trades for specific symbol
91
104
  client.trades('BTC_USDT', limit: 10)
105
+ ```
106
+
107
+ ### Authenticated V1 API Endpoints
108
+
109
+ #### Account Endpoints
110
+
111
+ ```ruby
112
+ # Account information
113
+ client.accounts
114
+
115
+ # All account balances
116
+ client.accounts_balances
117
+
118
+ # Account activity
119
+ client.accounts_activity(limit: 10)
92
120
 
121
+ # Accounts transfer
122
+ client.accounts_transfer(
123
+ currency: 'USDT',
124
+ amount: 10.5,
125
+ from_account: 'SPOT',
126
+ to_account: 'FUTURES'
127
+ )
128
+
129
+ # Accounts transfer records
130
+ client.accounts_transfer_records
131
+
132
+ # Fee info
133
+ client.fee_info
134
+
135
+ # Interest history
136
+ client.accounts_interest_history
93
137
  ```
94
138
 
139
+ #### Margin Endpoints
140
+ ```ruby
141
+ # Account margin
142
+ client.account_margin
143
+
144
+ # Borrow status
145
+ client.borrow_status
146
+
147
+ # Borrow status for a particulcar coin
148
+ client.borrow_status(currency: 'BTC')
149
+
150
+ #
151
+ client.max_buy_sell_amount('BTC_USDT')
152
+ ```
153
+
154
+ #### Order Endpoints
155
+ ```ruby
156
+
157
+ # Create order
158
+ client.create_order(
159
+ symbol: 'BTC_USDT',
160
+ side: 'BUY',
161
+ type: 'LIMIT',
162
+ quantity: 0.001,
163
+ price: 20_000
164
+ )
165
+
166
+ # Create multiple orders
167
+ client.create_multiple_orders(
168
+ [
169
+ {
170
+ symbol: 'BTC_USDT',
171
+ side: 'BUY',
172
+ type: 'LIMIT',
173
+ quantity: 0.01,
174
+ price: 15_000
175
+ },
176
+ {
177
+ symbol: 'BTC_USDT',
178
+ side: 'BUY',
179
+ type: 'LIMIT',
180
+ quantity: 0.1,
181
+ price: 8_000
182
+ }
183
+ ]
184
+ )
185
+
186
+ # Cancel replace order
187
+ client.cancel_replace_order(order_id: 'blue')
188
+
189
+ # Open orders for all symbols
190
+ client.open_orders
191
+
192
+ # Open orders for specific symbol
193
+ client.open_orders(symbol: 'BTC_USDT')
194
+
195
+ # Order details
196
+ client.order_details(order_id: '21934611974062080')
197
+
198
+ # Cancel order
199
+ client.cancel_order(order_id: '32487004629499904')
200
+
201
+ # Cancel multiple orders
202
+ client.cancel_multiple_orders(order_ids: ['12345', '67890'])
203
+
204
+ # Cancel all orders
205
+ client.subject.cancel_all_orders(
206
+ symbols: %w{BTC_USDT ETH_USDT},
207
+ account_types: %w{SPOT}
208
+ )
209
+
210
+ # Kill switch
211
+ client.subject.kill_switch(timeout: 10)
212
+
213
+ # Kill switch status
214
+ client.subject.kill_switch_status
215
+ ```
216
+
217
+ ### Wallet Endpoints
218
+ ```ruby
219
+ # Deposit addresses
220
+ client.deposit_addresses
221
+
222
+ # Deposit addresses for specific coin
223
+ client.deposit_addresses('BTC')
224
+
225
+ # Wallets activity records
226
+ client.wallets_activity(start: 1754734725, finish: 1754739175)
227
+
228
+ # New currency address
229
+ client.new_currency_address('BTC')
230
+
231
+ # Withdraw currency
232
+ client.withdraw_currency(
233
+ currency: "BTC",
234
+ amount: "0.1",
235
+ address: "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
236
+ )
237
+ ```
238
+
239
+
95
240
  ## Development
96
241
 
97
242
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
98
243
 
99
244
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
100
245
 
246
+
101
247
  ## Contributing
102
248
 
103
249
  Bug reports and pull requests are welcome on GitHub at https://github.com/yourusername/poloniex.rb.
@@ -105,14 +251,13 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/yourus
105
251
 
106
252
  ## Contributing
107
253
 
108
- 1. Fork it (https://github.com/thoran/bitget.rb/fork)
254
+ 1. Fork it (https://github.com/thoran/poloniex.rb/fork)
109
255
  2. Create your feature branch (`git checkout -b my-new-feature`)
110
256
  3. Commit your changes (`git commit -am 'Add some feature'`)
111
257
  4. Push to the branch (`git push origin my-new-feature`)
112
258
  5. Create a new pull request
113
259
 
114
260
 
115
-
116
261
  ## License
117
262
 
118
- The gem is available as open source under the terms of the [Ruby License](https://opensource.org/licenses/MIT).
263
+ The gem is available as open source under the terms of the [Ruby License](https://en.wikipedia.org/wiki/Ruby_License).
@@ -0,0 +1,7 @@
1
+ # Hash/x_www_form_urlencode.rb
2
+ # Hash#x_www_form_urlencode
3
+
4
+ # 20241009
5
+ # 0.1.0
6
+
7
+ require 'Thoran/Hash/XWwwFormUrlencode/x_www_form_urlencode'
data/lib/Object/inQ.rb ADDED
@@ -0,0 +1,18 @@
1
+ # Object/self.inQ
2
+ # Object.in?
3
+
4
+ # 20111114
5
+ # 0.5.0
6
+
7
+ # Description: This is essentially the reverse of Enumerable.include?. It can be pointed at any object and takes a collection as an argument.
8
+
9
+ # Changes:
10
+ # 1. Using Enumerable#flatten instead of testing the first argument in the argument list, since ths makes the code much shorter.
11
+
12
+ class Object
13
+
14
+ def in?(*a)
15
+ a.flatten.include?(self)
16
+ end
17
+
18
+ end
@@ -4,5 +4,10 @@
4
4
  require_relative './V1/Client'
5
5
 
6
6
  module Poloniex
7
- class Client < Poloniex::V1::Client; end
7
+ class Client < Poloniex::V1::Client
8
+
9
+ ALLOWABLE_VERBS = %w{GET POST PUT DELETE}
10
+ API_HOST = 'api.poloniex.com'
11
+
12
+ end
8
13
  end