Skip to content

Commit

Permalink
Merge pull request #7 from binance/rc-1.1.0
Browse files Browse the repository at this point in the history
Rc 1.1.0
  • Loading branch information
2pd committed Jun 9, 2022
2 parents 039a261 + f769bce commit 7075815
Show file tree
Hide file tree
Showing 137 changed files with 1,401 additions and 424 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: Ruby

on: [push]
on:
push:
branches:
- master
pull_request:
branches:
- master
- rc-**

jobs:
build:

strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--format documentation
--color
--require spec_helper
--fail-fast
147 changes: 144 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 2.5

Metrics/LineLength:
Layout/LineLength:
Max: 200

Metrics/BlockLength:
Expand All @@ -26,4 +26,145 @@ Metrics/ParameterLists:
Max: 10

Metrics/ModuleLength:
Max: 200
Enabled: false

Gemspec/DateAssignment:
Enabled: true

Style/SwapValues:
Enabled: true

Style/StringChars:
Enabled: true

Style/SelectByRegexp:
Enabled: true

Style/RedundantSelfAssignmentBranch:
Enabled: true

Style/RedundantArgument:
Enabled: true

Style/QuotedSymbols:
Enabled: true

Style/OpenStructUse:
Enabled: true

Style/NumberedParametersLimit:
Enabled: true

Style/NumberedParameters:
Enabled: true

Style/NilLambda:
Enabled: true

Style/NegatedIfElseCondition:
Enabled: true

Style/MultilineInPatternThen:
Enabled: true

Style/HashConversion:
Enabled: true

Security/IoMethods: # new in 1.22
Enabled: true

Style/ArgumentsForwarding: # new in 1.1
Enabled: true

Style/CollectionCompact: # new in 1.2
Enabled: true

Style/DocumentDynamicEvalDefinition: # new in 1.1
Enabled: true

Style/EndlessMethod: # new in 1.8
Enabled: true

Style/HashExcept: # new in 1.7
Enabled: true

Style/IfWithBooleanLiteralBranches: # new in 1.9
Enabled: true

Style/InPatternThen: # new in 1.16
Enabled: true

Lint/NumberedParameterAssignment: # new in 1.9
Enabled: true

Lint/OrAssignmentToConstant: # new in 1.9
Enabled: true

Lint/RedundantDirGlobSort: # new in 1.8
Enabled: true

Lint/RequireRelativeSelfPath: # new in 1.22
Enabled: true

Lint/SymbolConversion: # new in 1.9
Enabled: true

Lint/ToEnumArguments: # new in 1.1
Enabled: true

Lint/TripleQuotes: # new in 1.9
Enabled: true

Lint/UnexpectedBlockArity: # new in 1.5
Enabled: true

Lint/UnmodifiedReduceAccumulator: # new in 1.1
Enabled: true

Lint/UselessRuby2Keywords: # new in 1.23
Enabled: true

Lint/DuplicateBranch: # new in 1.3
Enabled: true

Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
Enabled: true

Lint/EmptyBlock: # new in 1.1
Enabled: true

Lint/EmptyClass: # new in 1.3
Enabled: true

Lint/EmptyInPattern: # new in 1.16
Enabled: true

Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
Enabled: true

Lint/LambdaWithoutLiteralBlock: # new in 1.8
Enabled: true

Lint/NoReturnInBeginEndBlocks: # new in 1.2
Enabled: true

Lint/AmbiguousAssignment: # new in 1.7
Enabled: true

Lint/AmbiguousOperatorPrecedence: # new in 1.21
Enabled: true

Lint/AmbiguousRange: # new in 1.19
Enabled: true

Lint/DeprecatedConstants: # new in 1.8
Enabled: true

Gemspec/RequireMFA: # new in 1.23
Enabled: true

Layout/LineEndStringConcatenationIndentation: # new in 1.18
Enabled: true

Layout/SpaceBeforeBrackets: # new in 1.7
Enabled: true
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 1.1.0 - 2022-06-09

### Add
- Convert endpoint
- `GET /sapi/v1/convert/tradeFlow`
- Margin Endpoint
- `GET /sapi/v1/margin/crossMarginData`
- `GET /sapi/v1/margin/isolatedMarginData`
- `GET /sapi/v1/margin/isolatedMarginTier`
- `GET /sapi/v1/margin/rateLimit/order`
- All Staking Endpoints

### Update
- Fixing rubocop warnnings

## 1.0.3 - 2022-05-06
- Update rake version

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ This is a lightweight library that works as a connector to [Binance public API](
```shell
gem install binance-connector-ruby
```

## Documentation

[https://www.rubydoc.info/gems/binance-connector-ruby](https://www.rubydoc.info/gems/binance-connector-ruby)

## Restful APIs

```ruby
Expand Down
3 changes: 3 additions & 0 deletions binance-connector-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_runtime_dependency 'faraday', '~> 1.8'
spec.add_runtime_dependency 'websocket-eventmachine-client', '~> 1.3'
spec.metadata = {
'rubygems_mfa_required' => 'true'
}
end
15 changes: 15 additions & 0 deletions examples/spot/convert/convert_trade_flow.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift('./lib')

require 'binance'
require_relative '../../common'

logger = Common.setup_logger

# set key here
# or BINANCE_PUBLIC_API_KEY in env
client = Binance::Spot.new(key: '', secret: '')

logger.info(client.convert_trade_flow(startTime: 1_640_998_861_000, endTime: 1_646_096_461_000))
15 changes: 15 additions & 0 deletions examples/spot/margin/get_cross_margin_data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift('./lib')

require 'binance'
require_relative '../../common'

logger = Common.setup_logger

# set key here
# or BINANCE_PUBLIC_API_KEY in env
client = Binance::Spot.new(key: '', secret: '')

logger.info(client.get_cross_margin_data)
15 changes: 15 additions & 0 deletions examples/spot/margin/get_isolated_margin_data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift('./lib')

require 'binance'
require_relative '../../common'

logger = Common.setup_logger

# set key here
# or BINANCE_PUBLIC_API_KEY in env
client = Binance::Spot.new(key: '', secret: '')

logger.info(client.get_isolated_margin_data)
16 changes: 16 additions & 0 deletions examples/spot/margin/get_isolated_margin_tier.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift('./lib')

require 'binance'
require_relative '../../common'

logger = Common.setup_logger

# set key here
# or BINANCE_PUBLIC_API_KEY in env
# client = Binance::Spot.new(key: '', secret: '')
client = Binance::Spot.new(key: '', secret: '')

logger.info(client.get_isolated_margin_tier(symbol: 'BTCUSDT', tier: 2))
15 changes: 15 additions & 0 deletions examples/spot/margin/get_margin_order_usage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift('./lib')

require 'binance'
require_relative '../../common'

logger = Common.setup_logger

# set key here
# or BINANCE_PUBLIC_API_KEY in env
client = Binance::Spot.new(key: '', secret: '')

logger.info(client.get_margin_order_usage)
6 changes: 3 additions & 3 deletions examples/spot/margin/margin_borrow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
client = Binance::Spot.new(key: '', secret: '')

params = {
"asset": 'BNB',
"amount": 0.01,
"recvWindow": 1_000
asset: 'BNB',
amount: 0.01,
recvWindow: 1_000
}

logger.info(client.margin_borrow(**params))
6 changes: 3 additions & 3 deletions examples/spot/margin/margin_cancel_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# or BINANCE_PUBLIC_API_KEY in env
client = Binance::Spot.new(key: '')
params = {
"symbol": 'BNBUSDT',
"orderId": '554522951',
"recvWindow": 5_000
symbol: 'BNBUSDT',
orderId: '554522951',
recvWindow: 5_000
}
logger.info(client.margin_cancel_order(**params))
14 changes: 7 additions & 7 deletions examples/spot/margin/margin_new_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
# or BINANCE_PUBLIC_API_KEY in env
client = Binance::Spot.new(key: '')
params = {
"symbol": 'BNBUSDT',
"side": 'SELL',
"type": 'LIMIT',
"quantity": 1,
"price": '30',
"timeInForce": 'GTC',
"recvWindow": 5_000
symbol: 'BNBUSDT',
side: 'SELL',
type: 'LIMIT',
quantity: 1,
price: '30',
timeInForce: 'GTC',
recvWindow: 5_000
}
logger.info(client.margin_new_order(**params))
14 changes: 7 additions & 7 deletions examples/spot/margin/margin_oco_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
client = Binance::Spot.new(key: '', secret: '')

params = {
"symbol": 'BNBUSDT',
"side": 'BUY',
"quantity": 0.1,
"price": 410,
"stopPrice": 400,
"stopLimitPrice": 400.1,
"stopLimitTimeInForce": 'GTC'
symbol: 'BNBUSDT',
side: 'BUY',
quantity: 0.1,
price: 410,
stopPrice: 400,
stopLimitPrice: 400.1,
stopLimitTimeInForce: 'GTC'
}

logger.info(client.margin_oco_order(**params))
6 changes: 3 additions & 3 deletions examples/spot/margin/margin_repay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
client = Binance::Spot.new(key: '', secret: '')

params = {
"asset": 'BNB',
"amount": 0.01,
"recvWindow": 1_000
asset: 'BNB',
amount: 0.01,
recvWindow: 1_000
}

logger.info(client.margin_repay(**params))
8 changes: 4 additions & 4 deletions examples/spot/margin/margin_transfer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
client = Binance::Spot.new(key: '', secret: '')

params = {
"asset": 'BNB',
"amount": 0.01,
"type": 1,
"recvWindow": 1_000
asset: 'BNB',
amount: 0.01,
type: 1,
recvWindow: 1_000
}

logger.info(client.margin_transfer(**params))
Loading

0 comments on commit 7075815

Please sign in to comment.