binance-connector-ruby 1.6.0 → 1.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 +4 -4
- data/CHANGELOG.md +76 -0
- data/lib/binance/session.rb +2 -1
- data/lib/binance/spot/convert.rb +133 -1
- data/lib/binance/spot/loan.rb +219 -5
- data/lib/binance/spot/margin.rb +85 -0
- data/lib/binance/spot/market.rb +73 -14
- data/lib/binance/spot/simple_earn.rb +20 -0
- data/lib/binance/spot/subaccount.rb +173 -0
- data/lib/binance/spot/trade.rb +93 -29
- data/lib/binance/spot/wallet.rb +118 -0
- data/lib/binance/spot/websocket.rb +12 -0
- data/lib/binance/version.rb +1 -1
- metadata +6 -6
    
        data/lib/binance/spot/trade.rb
    CHANGED
    
    | @@ -29,7 +29,7 @@ module Binance | |
| 29 29 | 
             
                  # @option kwargs [Float] :icebergeQty
         | 
| 30 30 | 
             
                  # @option kwargs [String] :newOrderRespType Set the response JSON. ACK, RESULT, or FULL.
         | 
| 31 31 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 32 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#test-new-order-trade
         | 
| 32 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#test-new-order-trade
         | 
| 33 33 | 
             
                  def new_order_test(symbol:, side:, type:, **kwargs)
         | 
| 34 34 | 
             
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 35 35 | 
             
                    Binance::Utils::Validation.require_param('side', side)
         | 
| @@ -61,7 +61,7 @@ module Binance | |
| 61 61 | 
             
                  # @option kwargs [Float] :icebergeQty
         | 
| 62 62 | 
             
                  # @option kwargs [String] :newOrderRespType Set the response JSON. ACK, RESULT, or FULL.
         | 
| 63 63 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 64 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#new-order-trade
         | 
| 64 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#new-order-trade
         | 
| 65 65 | 
             
                  def new_order(symbol:, side:, type:, **kwargs)
         | 
| 66 66 | 
             
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 67 67 | 
             
                    Binance::Utils::Validation.require_param('side', side)
         | 
| @@ -84,7 +84,7 @@ module Binance | |
| 84 84 | 
             
                  # @option kwargs [String] :origClientOrderId
         | 
| 85 85 | 
             
                  # @option kwargs [String] :newClientOrderId
         | 
| 86 86 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 87 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-order-trade
         | 
| 87 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-order-trade
         | 
| 88 88 | 
             
                  def cancel_order(symbol:, **kwargs)
         | 
| 89 89 | 
             
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 90 90 |  | 
| @@ -98,7 +98,7 @@ module Binance | |
| 98 98 | 
             
                  # @param symbol [String] the symbol
         | 
| 99 99 | 
             
                  # @param kwargs [Hash]
         | 
| 100 100 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 101 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-all-open-orders-on-a-symbol-trade
         | 
| 101 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-all-open-orders-on-a-symbol-trade
         | 
| 102 102 | 
             
                  def cancel_open_orders(symbol:, **kwargs)
         | 
| 103 103 | 
             
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 104 104 |  | 
| @@ -114,7 +114,7 @@ module Binance | |
| 114 114 | 
             
                  # @option kwargs [Integer] :orderId
         | 
| 115 115 | 
             
                  # @option kwargs [String] :origClientOrderId
         | 
| 116 116 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 117 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-order-user_data
         | 
| 117 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-order-user_data
         | 
| 118 118 | 
             
                  def get_order(symbol:, **kwargs)
         | 
| 119 119 | 
             
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 120 120 |  | 
| @@ -128,7 +128,7 @@ module Binance | |
| 128 128 | 
             
                  # @param kwargs [Hash]
         | 
| 129 129 | 
             
                  # @option kwargs [String] :symbol the symbol
         | 
| 130 130 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 131 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#current-open-orders-user_data
         | 
| 131 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#current-open-orders-user_data
         | 
| 132 132 | 
             
                  def open_orders(**kwargs)
         | 
| 133 133 | 
             
                    @session.sign_request(:get, '/api/v3/openOrders', params: kwargs)
         | 
| 134 134 | 
             
                  end
         | 
| @@ -146,7 +146,7 @@ module Binance | |
| 146 146 | 
             
                  # @option kwargs [String] :endTime
         | 
| 147 147 | 
             
                  # @option kwargs [String] :limit Default 500; max 1000.
         | 
| 148 148 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 149 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#all-orders-user_data
         | 
| 149 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#all-orders-user_data
         | 
| 150 150 | 
             
                  def all_orders(symbol:, **kwargs)
         | 
| 151 151 | 
             
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 152 152 |  | 
| @@ -162,32 +162,42 @@ module Binance | |
| 162 162 | 
             
                  # @param symbol [String] the symbol
         | 
| 163 163 | 
             
                  # @param side [String]
         | 
| 164 164 | 
             
                  # @param quantity [Float]
         | 
| 165 | 
            -
                  # @param  | 
| 166 | 
            -
                  # @param  | 
| 165 | 
            +
                  # @param aboveType [String]
         | 
| 166 | 
            +
                  # @param belowType [String]
         | 
| 167 167 | 
             
                  # @param kwargs [Hash]
         | 
| 168 168 | 
             
                  # @option kwargs [String] :listClientOrderId
         | 
| 169 | 
            -
                  # @option kwargs [String] : | 
| 170 | 
            -
                  # @option kwargs [ | 
| 171 | 
            -
                  # @option kwargs [ | 
| 172 | 
            -
                  # @option kwargs [Float] : | 
| 173 | 
            -
                  # @option kwargs [ | 
| 174 | 
            -
                  # @option kwargs [Float] : | 
| 169 | 
            +
                  # @option kwargs [String] :aboveClientOrderId Arbitrary unique ID among open orders for the above order. Automatically generated if not sent
         | 
| 170 | 
            +
                  # @option kwargs [Integer] :aboveIcebergQty Note that this can only be used if aboveTimeInForce is GTC
         | 
| 171 | 
            +
                  # @option kwargs [Float] :abovePrice
         | 
| 172 | 
            +
                  # @option kwargs [Float] :aboveStopPriceCan be used if aboveType is STOP_LOSS or STOP_LOSS_LIMIT. Either aboveStopPrice or aboveTrailingDelta or both, must be specified.
         | 
| 173 | 
            +
                  # @option kwargs [Integer] :aboveTrailingDelta
         | 
| 174 | 
            +
                  # @option kwargs [Float] :aboveTimeInForce Required if the aboveType is STOP_LOSS_LIMIT.
         | 
| 175 | 
            +
                  # @option kwargs [Integer] :aboveStrategyId Arbitrary numeric value identifying the above order within an order strategy.
         | 
| 176 | 
            +
                  # @option kwargs [Integer] :aboveStrategyType Arbitrary numeric value identifying the above order strategy. Values smaller than 1000000 are reserved and cannot be used.
         | 
| 177 | 
            +
                  # @option kwargs [String] :belowClientOrderId Arbitrary unique ID among open orders for the below order. Automatically generated if not sent
         | 
| 178 | 
            +
                  # @option kwargs [Integer] :belowIcebergQty Note that this can only be used if belowTimeInForce is GTC
         | 
| 179 | 
            +
                  # @option kwargs [Float] :belowPrice Can be used if belowType is STOP_LOSS_LIMIT or LIMIT_MAKER to specify the limit price.
         | 
| 180 | 
            +
                  # @option kwargs [Float] :belowStopPrice Can be used if belowType is STOP_LOSS or STOP_LOSS_LIMIT. Either belowStopPrice or belowTrailingDelta or both, must be specified.
         | 
| 181 | 
            +
                  # @option kwargs [Integer] :belowTrailingDelta
         | 
| 182 | 
            +
                  # @option kwargs [String] :belowTimeInForce Required if the belowType is STOP_LOSS_LIMIT
         | 
| 183 | 
            +
                  # @option kwargs [Integer] :belowStrategyId Arbitrary numeric value identifying the below order within an order strategy
         | 
| 184 | 
            +
                  # @option kwargs [String] :belowStrategyType Arbitrary numeric value identifying the below order strategy. Values smaller than 1000000 are reserved and cannot be used.
         | 
| 175 185 | 
             
                  # @option kwargs [String] :newOrderRespType
         | 
| 176 186 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 177 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#new-oco | 
| 178 | 
            -
                  def new_oco_order(symbol:, side:, quantity:,  | 
| 187 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#new-order-list---oco-trade
         | 
| 188 | 
            +
                  def new_oco_order(symbol:, side:, quantity:, aboveType:, belowType:, **kwargs)
         | 
| 179 189 | 
             
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 180 190 | 
             
                    Binance::Utils::Validation.require_param('side', side)
         | 
| 181 191 | 
             
                    Binance::Utils::Validation.require_param('quantity', quantity)
         | 
| 182 | 
            -
                    Binance::Utils::Validation.require_param(' | 
| 183 | 
            -
                    Binance::Utils::Validation.require_param(' | 
| 192 | 
            +
                    Binance::Utils::Validation.require_param('aboveType', aboveType)
         | 
| 193 | 
            +
                    Binance::Utils::Validation.require_param('belowType', belowType)
         | 
| 184 194 |  | 
| 185 195 | 
             
                    @session.sign_request(:post, '/api/v3/order/oco', params: kwargs.merge(
         | 
| 186 196 | 
             
                      symbol: symbol,
         | 
| 187 197 | 
             
                      side: side,
         | 
| 188 198 | 
             
                      quantity: quantity,
         | 
| 189 | 
            -
                       | 
| 190 | 
            -
                       | 
| 199 | 
            +
                      aboveType: aboveType,
         | 
| 200 | 
            +
                      belowType: belowType
         | 
| 191 201 | 
             
                    ))
         | 
| 192 202 | 
             
                  end
         | 
| 193 203 |  | 
| @@ -201,7 +211,7 @@ module Binance | |
| 201 211 | 
             
                  # @option kwargs [String] :listClientOrderId
         | 
| 202 212 | 
             
                  # @option kwargs [String] :newClientOrderId
         | 
| 203 213 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 204 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-order-list-trade
         | 
| 214 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-order-list-trade
         | 
| 205 215 | 
             
                  def cancel_order_list(symbol:, **kwargs)
         | 
| 206 216 | 
             
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 207 217 |  | 
| @@ -218,7 +228,7 @@ module Binance | |
| 218 228 | 
             
                  # @option kwargs [Integer] :orderListId
         | 
| 219 229 | 
             
                  # @option kwargs [String] :orgClientOrderId
         | 
| 220 230 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 221 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-order- | 
| 231 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-order-list-user_data
         | 
| 222 232 | 
             
                  def order_list(**kwargs)
         | 
| 223 233 | 
             
                    @session.sign_request(:get, '/api/v3/orderList', params: kwargs)
         | 
| 224 234 | 
             
                  end
         | 
| @@ -235,7 +245,7 @@ module Binance | |
| 235 245 | 
             
                  # @option kwargs [String] :endTime
         | 
| 236 246 | 
             
                  # @option kwargs [String] :limit Default 500; max 1000.
         | 
| 237 247 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 238 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-all-order-lists-user_data
         | 
| 248 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-all-order-lists-user_data
         | 
| 239 249 | 
             
                  def all_order_list(**kwargs)
         | 
| 240 250 | 
             
                    @session.sign_request(:get, '/api/v3/allOrderList', params: kwargs)
         | 
| 241 251 | 
             
                  end
         | 
| @@ -246,7 +256,7 @@ module Binance | |
| 246 256 | 
             
                  #
         | 
| 247 257 | 
             
                  # @param kwargs [Hash]
         | 
| 248 258 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 249 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-open-order-lists-user_data
         | 
| 259 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-open-order-lists-user_data
         | 
| 250 260 | 
             
                  def open_order_list(**kwargs)
         | 
| 251 261 | 
             
                    @session.sign_request(:get, '/api/v3/openOrderList', params: kwargs)
         | 
| 252 262 | 
             
                  end
         | 
| @@ -257,7 +267,7 @@ module Binance | |
| 257 267 | 
             
                  #
         | 
| 258 268 | 
             
                  # @param kwargs [Hash]
         | 
| 259 269 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 260 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#account-information-user_data
         | 
| 270 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#account-information-user_data
         | 
| 261 271 | 
             
                  def account(**kwargs)
         | 
| 262 272 | 
             
                    @session.sign_request(:get, '/api/v3/account', params: kwargs)
         | 
| 263 273 | 
             
                  end
         | 
| @@ -274,7 +284,7 @@ module Binance | |
| 274 284 | 
             
                  # @option kwargs [Integer] :fromId TradeId to fetch from. Default gets most recent trades.
         | 
| 275 285 | 
             
                  # @option kwargs [Integer] :limit Default 500; max 1000.
         | 
| 276 286 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 277 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#account-trade-list-user_data
         | 
| 287 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#account-trade-list-user_data
         | 
| 278 288 | 
             
                  def my_trades(symbol:, **kwargs)
         | 
| 279 289 | 
             
                    @session.sign_request(:get, '/api/v3/myTrades', params: kwargs.merge(symbol: symbol))
         | 
| 280 290 | 
             
                  end
         | 
| @@ -285,11 +295,59 @@ module Binance | |
| 285 295 | 
             
                  #
         | 
| 286 296 | 
             
                  # @param kwargs [Hash]
         | 
| 287 297 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 288 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query- | 
| 298 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-unfilled-order-count-user_data
         | 
| 289 299 | 
             
                  def get_order_rate_limit(**kwargs)
         | 
| 290 300 | 
             
                    @session.sign_request(:get, '/api/v3/rateLimit/order', params: kwargs)
         | 
| 291 301 | 
             
                  end
         | 
| 292 302 |  | 
| 303 | 
            +
                  # Query Prevented Matches (USER_DATA)
         | 
| 304 | 
            +
                  #
         | 
| 305 | 
            +
                  # GET /api/v3/myPreventedMatches
         | 
| 306 | 
            +
                  #
         | 
| 307 | 
            +
                  # @param symbol [String]
         | 
| 308 | 
            +
                  # @param kwargs [Hash]
         | 
| 309 | 
            +
                  # @param kwargs [Integer] :preventedMatchId
         | 
| 310 | 
            +
                  # @param kwargs [Integer] :orderId
         | 
| 311 | 
            +
                  # @param kwargs [Integer] :fromPreventedMatchId
         | 
| 312 | 
            +
                  # @param kwargs [Integer] :limit Default: 500; Max: 1000
         | 
| 313 | 
            +
                  # @param kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 314 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-prevented-matches-user_data
         | 
| 315 | 
            +
                  def my_prevented_matches(symbol:, **kwargs)
         | 
| 316 | 
            +
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 317 | 
            +
             | 
| 318 | 
            +
                    @session.sign_request(:get, '/api/v3/myPreventedMatches', params: kwargs.merge(symbol: symbol))
         | 
| 319 | 
            +
                  end
         | 
| 320 | 
            +
             | 
| 321 | 
            +
                  # Query Allocations (USER_DATA)
         | 
| 322 | 
            +
                  #
         | 
| 323 | 
            +
                  # GET /api/v3/myAllocations
         | 
| 324 | 
            +
                  #
         | 
| 325 | 
            +
                  # @param symbol [String]
         | 
| 326 | 
            +
                  # @param kwargs [Hash]
         | 
| 327 | 
            +
                  # @param kwargs [Integer] :startTime
         | 
| 328 | 
            +
                  # @param kwargs [Integer] :endTime
         | 
| 329 | 
            +
                  # @param kwargs [Integer] :fromAllocationId
         | 
| 330 | 
            +
                  # @param kwargs [Integer] :limit Default 500;Max 1000
         | 
| 331 | 
            +
                  # @param kwargs [Integer] :orderId
         | 
| 332 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-allocations-user_data
         | 
| 333 | 
            +
                  def my_allocations(symbol:, **kwargs)
         | 
| 334 | 
            +
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 335 | 
            +
             | 
| 336 | 
            +
                    @session.sign_request(:get, '/api/v3/myAllocations', params: kwargs.merge(symbol: symbol))
         | 
| 337 | 
            +
                  end
         | 
| 338 | 
            +
             | 
| 339 | 
            +
                  # Query Commission Rates (USER_DATA)
         | 
| 340 | 
            +
                  #
         | 
| 341 | 
            +
                  # GET /api/v3/account/commission
         | 
| 342 | 
            +
                  #
         | 
| 343 | 
            +
                  # @param symbol [String]
         | 
| 344 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-commission-rates-user_data
         | 
| 345 | 
            +
                  def commission_rate(symbol:)
         | 
| 346 | 
            +
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 347 | 
            +
             | 
| 348 | 
            +
                    @session.sign_request(:get, '/api/v3/account/commission', params: { symbol: symbol })
         | 
| 349 | 
            +
                  end
         | 
| 350 | 
            +
             | 
| 293 351 | 
             
                  # Cancel an Existing Order and Send a New Order (TRADE)
         | 
| 294 352 | 
             
                  #
         | 
| 295 353 | 
             
                  # POST /api/v3/order/cancelReplace
         | 
| @@ -307,12 +365,18 @@ module Binance | |
| 307 365 | 
             
                  # @option kwargs [String] :cancelOrigClientOrderId
         | 
| 308 366 | 
             
                  # @option kwargs [Integer] :cancelOrderId
         | 
| 309 367 | 
             
                  # @option kwargs [String] :newClientOrderId
         | 
| 368 | 
            +
                  # @option kwargs [Integer] :strategyId
         | 
| 369 | 
            +
                  # @option kwargs [Integer] :strategyType The value cannot be less than 1000000
         | 
| 310 370 | 
             
                  # @option kwargs [Float] :stopPrice
         | 
| 311 371 | 
             
                  # @option kwargs [Integer] :trailingDelta
         | 
| 312 372 | 
             
                  # @option kwargs [Float] :icebergQty
         | 
| 313 373 | 
             
                  # @option kwargs [String] :newOrderRespType
         | 
| 374 | 
            +
                  # @option kwargs [String] :selfTradePreventionMode The allowed enums is dependent on what is configured on the symbo
         | 
| 375 | 
            +
                  # @option kwargs [String] :cancelRestrictions ONLY_NEW - Cancel will succeed if the order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED
         | 
| 376 | 
            +
                  # @option kwargs [String] :orderRateLimitExceededMode DO_NOTHING (default)- will only attempt to cancel the order if account has not exceeded the unfilled order rate limit
         | 
| 377 | 
            +
                  #                          CANCEL_ONLY - will always cancel the order
         | 
| 314 378 | 
             
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 315 | 
            -
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-an-existing-order-and-send-a-new-order-trade
         | 
| 379 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-an-existing-order-and-send-a-new-order-trade
         | 
| 316 380 | 
             
                  def cancel_replace(symbol:, side:, type:, cancelReplaceMode:, **kwargs)
         | 
| 317 381 | 
             
                    Binance::Utils::Validation.require_param('symbol', symbol)
         | 
| 318 382 | 
             
                    Binance::Utils::Validation.require_param('side', side)
         | 
    
        data/lib/binance/spot/wallet.rb
    CHANGED
    
    | @@ -16,6 +16,17 @@ module Binance | |
| 16 16 | 
             
                    @session.public_request(path: '/sapi/v1/system/status')
         | 
| 17 17 | 
             
                  end
         | 
| 18 18 |  | 
| 19 | 
            +
                  # Get symbols delist schedule for spot (MARKET_DATA)
         | 
| 20 | 
            +
                  #
         | 
| 21 | 
            +
                  # GET /sapi/v1/spot/delist-schedule
         | 
| 22 | 
            +
                  #
         | 
| 23 | 
            +
                  # @param kwargs [Hash]
         | 
| 24 | 
            +
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 25 | 
            +
                  # @see https://developers.binance.com/docs/wallet/others/delist-schedule
         | 
| 26 | 
            +
                  def delist_schedule(**kwargs)
         | 
| 27 | 
            +
                    @session.public_request(path: '/sapi/v1/spot/delist-schedule', params: kwargs)
         | 
| 28 | 
            +
                  end
         | 
| 29 | 
            +
             | 
| 19 30 | 
             
                  # All Coins' Information (USER_DATA)
         | 
| 20 31 | 
             
                  #
         | 
| 21 32 | 
             
                  # GET /sapi/v1/capital/config/getall
         | 
| @@ -149,6 +160,36 @@ module Binance | |
| 149 160 | 
             
                    ))
         | 
| 150 161 | 
             
                  end
         | 
| 151 162 |  | 
| 163 | 
            +
                  # Fetch deposit address list with network (USER_DATA)
         | 
| 164 | 
            +
                  #
         | 
| 165 | 
            +
                  # GET /sapi/v1/capital/deposit/address/list
         | 
| 166 | 
            +
                  #
         | 
| 167 | 
            +
                  # @param coin [String] coin refers to the parent network address format that the address is using
         | 
| 168 | 
            +
                  # @param kwargs [Hash]
         | 
| 169 | 
            +
                  # @option kwargs [String] :network
         | 
| 170 | 
            +
                  # @see https://developers.binance.com/docs/wallet/capital/fetch-deposit-address-list-with-network
         | 
| 171 | 
            +
                  def deposit_address_list(coin:, **kwargs)
         | 
| 172 | 
            +
                    Binance::Utils::Validation.require_param('coin', coin)
         | 
| 173 | 
            +
             | 
| 174 | 
            +
                    @session.sign_request(:get, '/sapi/v1/capital/deposit/address/list', params: kwargs.merge(
         | 
| 175 | 
            +
                      coin: coin
         | 
| 176 | 
            +
                    ))
         | 
| 177 | 
            +
                  end
         | 
| 178 | 
            +
             | 
| 179 | 
            +
                  # One click arrival deposit apply (for expired address deposit) (USER_DATA)
         | 
| 180 | 
            +
                  #
         | 
| 181 | 
            +
                  # POST /sapi/v1/capital/deposit/credit-apply
         | 
| 182 | 
            +
                  #
         | 
| 183 | 
            +
                  # @param kwargs [Hash]
         | 
| 184 | 
            +
                  # @option kwargs [String] :depositId Deposit record Id, priority use
         | 
| 185 | 
            +
                  # @option kwargs [String] :txId Deposit txId, used when depositId is not specified
         | 
| 186 | 
            +
                  # @option kwargs [String] :subAccountId Sub-accountId of Cloud user
         | 
| 187 | 
            +
                  # @option kwargs [String] :subUserId Sub-userId of parent user
         | 
| 188 | 
            +
                  # @see https://developers.binance.com/docs/wallet/capital/one-click-arrival-deposite-apply
         | 
| 189 | 
            +
                  def one_click_arrival_deposit_apply(**kwargs)
         | 
| 190 | 
            +
                    @session.sign_request(:post, '/sapi/v1/capital/deposit/credit-apply', params: kwargs)
         | 
| 191 | 
            +
                  end
         | 
| 192 | 
            +
             | 
| 152 193 | 
             
                  # Account Status (USER_DATA)
         | 
| 153 194 | 
             
                  #
         | 
| 154 195 | 
             
                  # GET /sapi/v1/account/status
         | 
| @@ -233,6 +274,17 @@ module Binance | |
| 233 274 | 
             
                    @session.sign_request(:get, '/sapi/v1/asset/assetDetail', params: kwargs)
         | 
| 234 275 | 
             
                  end
         | 
| 235 276 |  | 
| 277 | 
            +
                  # Query User Wallet Balance (USER_DATA)
         | 
| 278 | 
            +
                  #
         | 
| 279 | 
            +
                  # GET /sapi/v1/asset/wallet/balance
         | 
| 280 | 
            +
                  #
         | 
| 281 | 
            +
                  # @param kwargs [Hash]
         | 
| 282 | 
            +
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 283 | 
            +
                  # @see https://developers.binance.com/docs/wallet/asset/query-user-wallet-balance
         | 
| 284 | 
            +
                  def wallet_balance(**kwargs)
         | 
| 285 | 
            +
                    @session.sign_request(:get, '/sapi/v1/asset/wallet/balance', params: kwargs)
         | 
| 286 | 
            +
                  end
         | 
| 287 | 
            +
             | 
| 236 288 | 
             
                  # Trade Fee (USER_DATA)
         | 
| 237 289 | 
             
                  #
         | 
| 238 290 | 
             
                  # GET /sapi/v1/asset/tradeFee
         | 
| @@ -288,6 +340,18 @@ module Binance | |
| 288 340 | 
             
                    @session.sign_request(:get, '/sapi/v1/asset/transfer', params: kwargs.merge(type: type))
         | 
| 289 341 | 
             
                  end
         | 
| 290 342 |  | 
| 343 | 
            +
                  # Get Assets That Can Be Converted Into BNB (USER_DATA)
         | 
| 344 | 
            +
                  #
         | 
| 345 | 
            +
                  # POST /sapi/v1/asset/dust-btc
         | 
| 346 | 
            +
                  #
         | 
| 347 | 
            +
                  # @param kwargs [Hash]
         | 
| 348 | 
            +
                  # @option kwargs [String] :accountType SPOT or MARGIN,default SPOT
         | 
| 349 | 
            +
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 350 | 
            +
                  # @see https://developers.binance.com/docs/wallet/asset/assets-can-convert-bnb
         | 
| 351 | 
            +
                  def get_assets_converted_into_bnb(**kwargs)
         | 
| 352 | 
            +
                    @session.sign_request(:post, '/sapi/v1/asset/dust-btc', params: kwargs)
         | 
| 353 | 
            +
                  end
         | 
| 354 | 
            +
             | 
| 291 355 | 
             
                  # Funding Wallet (USER_DATA)
         | 
| 292 356 | 
             
                  #
         | 
| 293 357 | 
             
                  # POST /sapi/v1/asset/get-funding-asset
         | 
| @@ -301,6 +365,60 @@ module Binance | |
| 301 365 | 
             
                    @session.sign_request(:post, '/sapi/v1/asset/get-funding-asset', params: kwargs)
         | 
| 302 366 | 
             
                  end
         | 
| 303 367 |  | 
| 368 | 
            +
                  # Get Cloud-Mining payment and refund history (USER_DATA)
         | 
| 369 | 
            +
                  #
         | 
| 370 | 
            +
                  # GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage
         | 
| 371 | 
            +
                  #
         | 
| 372 | 
            +
                  # @param kwargs [Hash]
         | 
| 373 | 
            +
                  # @option kwargs [Integer] :tranId
         | 
| 374 | 
            +
                  # @option kwargs [String] :clientTranId The unique flag
         | 
| 375 | 
            +
                  # @option kwargs [String] :asset If it is blank, we will query all assets
         | 
| 376 | 
            +
                  # @option kwargs [Integer] :startTime inclusive, unit: ms
         | 
| 377 | 
            +
                  # @option kwargs [Integer] :endTime exclusive, unit: ms
         | 
| 378 | 
            +
                  # @option kwargs [Integer] :current current page, default 1, the min value is 1
         | 
| 379 | 
            +
                  # @option kwargs [Integer] :size page size, default 10, the max value is 100
         | 
| 380 | 
            +
                  # @see https://developers.binance.com/docs/wallet/asset/cloud-mining-payment-and-refund-history
         | 
| 381 | 
            +
                  def cloud_mining_payment_and_refund_history(**kwargs)
         | 
| 382 | 
            +
                    @session.sign_request(:get, '/sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage', params: kwargs)
         | 
| 383 | 
            +
                  end
         | 
| 384 | 
            +
             | 
| 385 | 
            +
                  # Query User Delegation History (For Master Account)(USER_DATA)
         | 
| 386 | 
            +
                  #
         | 
| 387 | 
            +
                  # GET /sapi/v1/asset/custody/transfer-history
         | 
| 388 | 
            +
                  #
         | 
| 389 | 
            +
                  # @param email [String]
         | 
| 390 | 
            +
                  # @param startTime [Integer]
         | 
| 391 | 
            +
                  # @param endTime [Integer]
         | 
| 392 | 
            +
                  # @param kwargs [Hash]
         | 
| 393 | 
            +
                  # @option kwargs [String] :type Delegate/Undelegate
         | 
| 394 | 
            +
                  # @option kwargs [String] :asset
         | 
| 395 | 
            +
                  # @option kwargs [Integer] :current Default 1
         | 
| 396 | 
            +
                  # @option kwargs [Integer] :size default 10, max 100
         | 
| 397 | 
            +
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 398 | 
            +
                  # @see https://developers.binance.com/docs/wallet/asset/query-user-delegation
         | 
| 399 | 
            +
                  def user_delegation_history(email:, startTime:, endTime:, **kwargs)
         | 
| 400 | 
            +
                    Binance::Utils::Validation.require_param('email', email)
         | 
| 401 | 
            +
                    Binance::Utils::Validation.require_param('startTime', startTime)
         | 
| 402 | 
            +
                    Binance::Utils::Validation.require_param('endTime', endTime)
         | 
| 403 | 
            +
             | 
| 404 | 
            +
                    @session.sign_request(:get, '/sapi/v1/asset/custody/transfer-history', params: kwargs.merge(
         | 
| 405 | 
            +
                      email: email,
         | 
| 406 | 
            +
                      startTime: startTime,
         | 
| 407 | 
            +
                      endTime: endTime
         | 
| 408 | 
            +
                    ))
         | 
| 409 | 
            +
                  end
         | 
| 410 | 
            +
             | 
| 411 | 
            +
                  # Account info (USER_DATA)
         | 
| 412 | 
            +
                  #
         | 
| 413 | 
            +
                  # GET /sapi/v1/account/info
         | 
| 414 | 
            +
                  #
         | 
| 415 | 
            +
                  # @param kwargs [Hash]
         | 
| 416 | 
            +
                  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
         | 
| 417 | 
            +
                  # @see https://developers.binance.com/docs/wallet/account
         | 
| 418 | 
            +
                  def account_info(**kwargs)
         | 
| 419 | 
            +
                    @session.sign_request(:get, '/sapi/v1/account/info', params: kwargs)
         | 
| 420 | 
            +
                  end
         | 
| 421 | 
            +
             | 
| 304 422 | 
             
                  # Get API Key Permission (USER_DATA)
         | 
| 305 423 | 
             
                  #
         | 
| 306 424 | 
             
                  # GET /sapi/v1/account/apiRestrictions
         | 
| @@ -99,6 +99,18 @@ module Binance | |
| 99 99 | 
             
                    create_connection(url, callbacks)
         | 
| 100 100 | 
             
                  end
         | 
| 101 101 |  | 
| 102 | 
            +
                  # Average Price
         | 
| 103 | 
            +
                  # Average price streams push changes in the average price over a fixed time interval.
         | 
| 104 | 
            +
                  # Stream Name: <symbol>@avgPrice
         | 
| 105 | 
            +
                  # Update Speed: 1000ms
         | 
| 106 | 
            +
                  #
         | 
| 107 | 
            +
                  # @param symbol [String]
         | 
| 108 | 
            +
                  # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#average-price
         | 
| 109 | 
            +
                  def avg_price(symbol:, callbacks:)
         | 
| 110 | 
            +
                    url = "#{@base_url}/ws/#{symbol.downcase}@avgPrice"
         | 
| 111 | 
            +
                    create_connection(url, callbacks)
         | 
| 112 | 
            +
                  end
         | 
| 113 | 
            +
             | 
| 102 114 | 
             
                  # Partial Book Depth Streams
         | 
| 103 115 | 
             
                  # Top bids and asks, Valid are 5, 10, or 20.
         | 
| 104 116 | 
             
                  # Stream Name: <symbol>@depth<levels> OR <symbol>@depth<levels>@100ms.
         | 
    
        data/lib/binance/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: binance-connector-ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.7.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Binance
         | 
| 8 | 
            -
            autorequire:
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 11 | 
            +
            date: 2024-12-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -95,7 +95,7 @@ dependencies: | |
| 95 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 96 | 
             
                    version: '1.3'
         | 
| 97 97 | 
             
            description: ''
         | 
| 98 | 
            -
            email:
         | 
| 98 | 
            +
            email: 
         | 
| 99 99 | 
             
            executables: []
         | 
| 100 100 | 
             
            extensions: []
         | 
| 101 101 | 
             
            extra_rdoc_files: []
         | 
| @@ -135,7 +135,7 @@ licenses: | |
| 135 135 | 
             
            - MIT
         | 
| 136 136 | 
             
            metadata:
         | 
| 137 137 | 
             
              rubygems_mfa_required: 'true'
         | 
| 138 | 
            -
            post_install_message:
         | 
| 138 | 
            +
            post_install_message: 
         | 
| 139 139 | 
             
            rdoc_options: []
         | 
| 140 140 | 
             
            require_paths:
         | 
| 141 141 | 
             
            - lib
         | 
| @@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 151 151 | 
             
                  version: '0'
         | 
| 152 152 | 
             
            requirements: []
         | 
| 153 153 | 
             
            rubygems_version: 3.3.3
         | 
| 154 | 
            -
            signing_key:
         | 
| 154 | 
            +
            signing_key: 
         | 
| 155 155 | 
             
            specification_version: 4
         | 
| 156 156 | 
             
            summary: This is a lightweight library that works as a connector to the Binance public
         | 
| 157 157 | 
             
              API.
         |