bitget 0.6.13 → 0.7.0

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: 3766e7b392db9c762d7ce053e5aaf91fb0d9e283048a7f3e9a9c76f64e0fbaf5
4
- data.tar.gz: 68eda9957b6fa0494dfc4ce4bc1213c0299ba2687f57ab41aa5b0d29434b69a0
3
+ metadata.gz: 352f95f68c7fbcc52056d0601fafe86e63e489fa939433345bc0a45b370ceb3c
4
+ data.tar.gz: '00380403957fc882a500006e8aaee0e3f533777b19d390447d8211a415d6d3d5'
5
5
  SHA512:
6
- metadata.gz: f86298e2d8347a6eee3c8831632a31e93477f34d27beeff853548d372be0b35d9e47619f610a9c0cc6dd078607d2129ae0dece36d9a8180416cb106bebca5c0a
7
- data.tar.gz: 8c9891d5bcb76094c987d8bbfddaa12e397da3aff63a2c5ab7973eb923397b6564c68a30dde753178c4f4606d7eea251ae25146828b00a0fa580f1dd834ab539
6
+ metadata.gz: 824e2125bf8bad0e0a77253a07cfd52725e395c04d2850c4d432903dfe6d8a1a3c8924a66de0de10cb91da3fb8e14f7dde19f859924aec39b4fe9bfc0ef93a3c
7
+ data.tar.gz: f139cfe864aea0295c739e2340174310f351c8d9ce9d7014fd5e449bb5ad6b78a37ac310834ad44824bd8ff5b0be8eab8a309685de967151fbddde0549810095
data/CHANGELOG CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## 20260925
4
4
 
5
+ 0.7.0: + Bitget::ERROR_CODES, generated from Bitget's published lists; + Bitget::Error#documented_message, #market_unavailable?.
6
+
7
+ 1. + bin/generate_error_codes: Writes lib/Bitget/ERROR_CODES.rb from the V2 REST, V2 WebSocket, and UTA REST lists, noting where they disagree and decoding HTML entities.
8
+ 2. + Bitget::ERROR_CODES: One table per list, in that order of precedence.
9
+ 3. + Bitget::Error::MARKET_UNAVAILABLE_CODES
10
+ 4. + Bitget::Error#documented_message
11
+ 5. + Bitget::Error#market_unavailable?
12
+ 6. + Rakefile: error_codes task.
13
+ 7. + test/ERROR_CODES_test.rb, test/Error_test.rb
14
+ 8. ~ README.md: + Errors section.
15
+ 9. ~ Bitget::VERSION: /0.6.13/0.7.0/
16
+
5
17
  0.6.13: - test/test_all.rb; ~ Rakefile: minimal, with warnings.
6
18
 
7
19
  1. - test/test_all.rb: The Rakefile's FileList makes it redundant.
data/README.md CHANGED
@@ -95,6 +95,37 @@ no longer does any of that: what is logged is the client's business and where it
95
95
  yours, which is what lets a StringIO logger in a test, or a levelled one, or something which
96
96
  is not a Logger at all, work as well as the above.
97
97
 
98
+ ### Errors
99
+
100
+ A request Bitget refuses raises `Bitget::Error`, which carries Bitget's own code and message
101
+ from the response body where there is one, and the HTTP code and message where there is not.
102
+
103
+ ```ruby
104
+ begin
105
+ bitget_client.spot_trade_place_order(symbol: 'XYZUSDT', side: 'buy', order_type: 'market', size: '10')
106
+ rescue Bitget::Error => e
107
+ raise unless e.market_unavailable?
108
+ puts e.error_message
109
+ end
110
+ ```
111
+
112
+ `#market_unavailable?` is true for the codes in `Bitget::Error::MARKET_UNAVAILABLE_CODES`, which
113
+ cover a market closed for maintenance, not yet open, or delisted.
114
+
115
+ `#documented_message` looks the code up in `Bitget::ERROR_CODES`, which holds the error code
116
+ lists Bitget publishes, one table for each: V2 REST, V2 WebSocket, and UTA REST. The first
117
+ of these to document the code answers. The lists are incomplete, V2 REST returning codes
118
+ which only the other two document, and the message Bitget returns does not always match
119
+ what it documents, so prefer `#error_message` for display. Regenerate the tables with
120
+ `rake error_codes`.
121
+
122
+ The lists do not always agree. A code may be documented differently in different lists,
123
+ as 40002 is; a code may appear more than once in the one list with different meanings, as
124
+ 40104 does in V2 REST, where its messages are kept as an array and `#documented_message`
125
+ answers with each of them, numbered: `"(1) ...; (2) ..."`; and a code may have only Bitget's placeholder for a missing
126
+ description, as 25220 does in V2 WebSocket, and is left out of that table. The comment at
127
+ the top of `lib/Bitget/ERROR_CODES.rb` lists each of these as at the last regeneration.
128
+
98
129
  ### Retrieve Info on All the Coins Traded
99
130
 
100
131
  ```ruby
data/Rakefile CHANGED
@@ -10,3 +10,8 @@ Rake::TestTask.new(:test) do |t|
10
10
  end
11
11
 
12
12
  task default: :test
13
+
14
+ desc "Regenerate lib/Bitget/ERROR_CODES.rb from the lists Bitget publishes"
15
+ task :error_codes do
16
+ ruby 'bin/generate_error_codes'
17
+ end