-
Notifications
You must be signed in to change notification settings - Fork 53
Usdm support #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
siegfried
wants to merge
73
commits into
daroczig:master
Choose a base branch
from
siegfried:usdm-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Usdm support #22
Changes from 17 commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
1f45c5c
Use testthat
siegfried 9e1577e
Use vcr
siegfried 7985d76
Test spot klines
siegfried c9e6010
Move api_key and secret out
siegfried 81f4f10
Rename fixtures
siegfried c1ea8d0
Test binance_exchange_info()
siegfried d6e5bf7
Test binance_sign
siegfried b9ef2fc
Move spot specific tests to test-spot.R
siegfried 041d806
Test binance_ticks()
siegfried 6c0dbcd
Test binance_trades()
siegfried 24e8d64
Test binance_depth()
siegfried 67aebbc
Test binance_ticker_price()
siegfried 5a07086
Test binance_ticker_book()
siegfried 97b1447
Test binance_avg_price()
siegfried 1971762
Improve test
siegfried 1b7d2cf
Move test helper as_time()
siegfried c824d1a
Fix binance_sign()
siegfried ae5fd01
Add base endpoint option of USDM
siegfried ef56b02
Add usdm_v1_ping()
siegfried 61f6157
Add usdm_v1_time()
siegfried 07b2727
Update RoxygenNote and the docs
siegfried 7cb3992
Add usdm_v1_exhange_info()
siegfried 655a57c
Rename as_time() to as_timestamp()
siegfried b4e1855
Improve constant structure
siegfried 8eefa5c
Add more test for usdm_v1_exchange_info()
siegfried 636d61d
Check base in binance_query() instead
siegfried eecd66c
Add usdm_v1_premium_index()
siegfried 00c5e7f
Add scale_filter
siegfried bb7473e
Implement usdm_filter_check.PRICE_FILTER
siegfried f9248fc
Rename scale_filter to validate_scale
siegfried 5f7ad6d
Check input
siegfried 0f52361
Add usdm_filter_check.LOT_SIZE
siegfried e2e2ad6
Add usdm_filter_check.MARKET_LOT_SIZE
siegfried 35aa331
Add filters of USDM order number
siegfried 8318270
Add usdm_filter_check.PERCENT_PRICE
siegfried 924173e
Add usdm_filter_check.MIN_NOTIONAL
siegfried 7a56aea
Add log to USDM filters
siegfried f05ad9b
Move spot tests back to test-binance.R
siegfried 45a661d
Add usdm_v1_new_order()
siegfried 98e1018
Add usdm_limit_order()
siegfried 3ca34e5
Update usdm_filter_check()
siegfried 701de73
Test is_algo_order()
siegfried 65a892f
Add usdm_v1_open_orders()
siegfried e1119a9
Add usdm_v1_filters()
siegfried f1f76a4
Add is_valid_usdm_order method
siegfried 349aab4
Rename usdm_filter_types
siegfried be9a541
Implement open_long_limit() and open_short_limit()
siegfried abe4e9b
Add usdm_v2_position_risks
siegfried 6685dfb
Improve documentation
siegfried 7ba597a
Update document
siegfried 4315076
Fix usdm_v1_open_orders result
siegfried dfbe308
Add close_long_limit()
siegfried 78e992a
Fix document
siegfried 299d856
Add close_short_limit()
siegfried 6ede8d0
Improve usdm_v1_premium_index()
siegfried ac365a1
Improve usdm_order_context()
siegfried fd46a52
Add convert_position_risks()
siegfried ccde301
Remove warning
siegfried 02dc732
Simplify execute_usdm_order()
siegfried d6b11ac
Make usdm_limit_order() simpler
siegfried 79f01a5
Implement market orders
siegfried c1ca6a0
Implement usdm_v2_account()
siegfried 15e2510
Add usdm_v1_change_initial_leverage()
siegfried 18b3ec3
Implement usdm_v1_change_margin_type()
siegfried 1f5c723
Export format() of orders
siegfried 1523953
Implement TAKE_PROFIT_MARKET order with closePosition=true
siegfried 0d951c9
Make symbol of usdm_v1_open_orders() optional
siegfried d31101c
Implement usdm_v1_cancel_order_by_id()
siegfried 4373010
Implement stop market order with closePosition=true
siegfried 3de6583
Implement usdm_v1_cancel_order_by_client_order_id()
siegfried b9a6084
Add binancer.recv_window option
siegfried 398cb12
Change document
siegfried f343d4d
Remove assertive
siegfried File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| * text=auto | ||
| tests/fixtures/**/* -diff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| http_interactions: | ||
| - request: | ||
| method: get | ||
| uri: https://api.binance.com/api/v3/avgPrice?symbol=ETHUSDT | ||
| body: | ||
| encoding: '' | ||
| string: '' | ||
| headers: | ||
| Accept: application/json, text/xml, application/xml, */* | ||
| response: | ||
| status: | ||
| status_code: 200 | ||
| category: Success | ||
| reason: OK | ||
| message: 'Success: (200) OK' | ||
| headers: | ||
| content-type: application/json;charset=UTF-8 | ||
| content-length: '34' | ||
| date: Fri, 17 Dec 2021 18:24:29 GMT | ||
| server: nginx | ||
| x-mbx-uuid: f41179c9-ac61-46c9-ae1e-e431e6c5c8e4 | ||
| x-mbx-used-weight: '1' | ||
| x-mbx-used-weight-1m: '1' | ||
| strict-transport-security: max-age=31536000; includeSubdomains | ||
| x-frame-options: SAMEORIGIN | ||
| x-xss-protection: 1; mode=block | ||
| x-content-type-options: nosniff | ||
| content-security-policy: default-src 'self' | ||
| x-content-security-policy: default-src 'self' | ||
| x-webkit-csp: default-src 'self' | ||
| cache-control: no-cache, no-store, must-revalidate | ||
| pragma: no-cache | ||
| expires: '0' | ||
| access-control-allow-origin: '*' | ||
| access-control-allow-methods: GET, HEAD, OPTIONS | ||
| x-cache: Miss from cloudfront | ||
| via: 1.1 c361075814ee65e6523d12c5af3e7995.cloudfront.net (CloudFront) | ||
| x-amz-cf-pop: SFO5-C1 | ||
| x-amz-cf-id: AR3YbnqaEq2Qbb33uLX_dWbRlwqjE19i5XmeL6p8D6bB6Xp_PsXfCw== | ||
| body: | ||
| encoding: UTF-8 | ||
| file: no | ||
| string: '{"mins":5,"price":"3862.30654683"}' | ||
| recorded_at: 2021-12-17 18:24:29 GMT | ||
| recorded_with: vcr/1.0.2, webmockr/0.8.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| http_interactions: | ||
| - request: | ||
| method: get | ||
| uri: https://api.binance.com/api/v1/depth?symbol=ETHUSDT&limit=5 | ||
| body: | ||
| encoding: '' | ||
| string: '' | ||
| headers: | ||
| Accept: application/json, text/xml, application/xml, */* | ||
| response: | ||
| status: | ||
| status_code: 200 | ||
| category: Success | ||
| reason: OK | ||
| message: 'Success: (200) OK' | ||
| headers: | ||
| content-type: application/json;charset=UTF-8 | ||
| content-length: '160' | ||
| date: Fri, 17 Dec 2021 17:12:19 GMT | ||
| server: nginx | ||
| x-mbx-uuid: e1dca5fe-b5db-4eea-b3f9-abd19fea6092 | ||
| x-mbx-used-weight: '1' | ||
| x-mbx-used-weight-1m: '1' | ||
| content-encoding: gzip | ||
| strict-transport-security: max-age=31536000; includeSubdomains | ||
| x-frame-options: SAMEORIGIN | ||
| x-xss-protection: 1; mode=block | ||
| x-content-type-options: nosniff | ||
| content-security-policy: default-src 'self' | ||
| x-content-security-policy: default-src 'self' | ||
| x-webkit-csp: default-src 'self' | ||
| cache-control: no-cache, no-store, must-revalidate | ||
| pragma: no-cache | ||
| expires: '0' | ||
| access-control-allow-origin: '*' | ||
| access-control-allow-methods: GET, HEAD, OPTIONS | ||
| x-cache: Miss from cloudfront | ||
| via: 1.1 2cd1423c218193e9646892449fb7844a.cloudfront.net (CloudFront) | ||
| x-amz-cf-pop: SFO5-C1 | ||
| x-amz-cf-id: d2GM8gRzdnCva4G5h6YSYpXp2u5iNq60tweA2-EqvBf45UkK2oJdjw== | ||
| body: | ||
| encoding: UTF-8 | ||
| file: no | ||
| string: '{"lastUpdateId":13304569353,"bids":[["3880.79000000","0.44760000"],["3880.69000000","0.02580000"],["3880.63000000","0.00300000"],["3880.59000000","0.18230000"],["3880.58000000","0.52010000"]],"asks":[["3880.80000000","4.60140000"],["3880.83000000","0.10710000"],["3880.84000000","0.11170000"],["3880.85000000","1.07750000"],["3881.01000000","0.19110000"]]}' | ||
| recorded_at: 2021-12-17 17:12:19 GMT | ||
| recorded_with: vcr/1.0.2, webmockr/0.8.0 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| http_interactions: | ||
| - request: | ||
| method: get | ||
| uri: https://api.binance.com/api/v1/klines?symbol=ETHUSDT&interval=1d&limit=1 | ||
| body: | ||
| encoding: '' | ||
| string: '' | ||
| headers: | ||
| Accept: application/json, text/xml, application/xml, */* | ||
| response: | ||
| status: | ||
| status_code: 200 | ||
| category: Success | ||
| reason: OK | ||
| message: 'Success: (200) OK' | ||
| headers: | ||
| content-type: application/json;charset=UTF-8 | ||
| content-length: '184' | ||
| date: Fri, 17 Dec 2021 13:24:50 GMT | ||
| server: nginx | ||
| x-mbx-uuid: 7e997bff-7134-4d74-8c56-ef81320e92c3 | ||
| x-mbx-used-weight: '1' | ||
| x-mbx-used-weight-1m: '1' | ||
| strict-transport-security: max-age=31536000; includeSubdomains | ||
| x-frame-options: SAMEORIGIN | ||
| x-xss-protection: 1; mode=block | ||
| x-content-type-options: nosniff | ||
| content-security-policy: default-src 'self' | ||
| x-content-security-policy: default-src 'self' | ||
| x-webkit-csp: default-src 'self' | ||
| cache-control: no-cache, no-store, must-revalidate | ||
| pragma: no-cache | ||
| expires: '0' | ||
| access-control-allow-origin: '*' | ||
| access-control-allow-methods: GET, HEAD, OPTIONS | ||
| x-cache: Miss from cloudfront | ||
| via: 1.1 2d57951832cb6c4e7185686912c96bb9.cloudfront.net (CloudFront) | ||
| x-amz-cf-pop: SFO5-C1 | ||
| x-amz-cf-id: rsVORgOs3iuJh_6eTuXWSo3EqIvjhEGpn319S74vOpSSXpT_-t3k9A== | ||
| body: | ||
| encoding: UTF-8 | ||
| file: no | ||
| string: '[[1639699200000,"3959.11000000","3994.10000000","3796.00000000","3820.87000000","210422.85360000",1639785599999,"819993474.31887900",470771,"105358.22610000","411011816.12338600","0"]]' | ||
| recorded_at: 2021-12-17 13:24:50 GMT | ||
| recorded_with: vcr/1.0.2, webmockr/0.8.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| http_interactions: | ||
| - request: | ||
| method: get | ||
| uri: https://api.binance.com/api/v1/ping | ||
| body: | ||
| encoding: '' | ||
| string: '' | ||
| headers: | ||
| Accept: application/json, text/xml, application/xml, */* | ||
| response: | ||
| status: | ||
| status_code: 200 | ||
| category: Success | ||
| reason: OK | ||
| message: 'Success: (200) OK' | ||
| headers: | ||
| content-type: application/json;charset=UTF-8 | ||
| content-length: '2' | ||
| date: Fri, 17 Dec 2021 13:18:17 GMT | ||
| server: nginx | ||
| x-mbx-uuid: 1d5d93ff-d7ca-4992-970e-22b429f7de52 | ||
| x-mbx-used-weight: '1' | ||
| x-mbx-used-weight-1m: '1' | ||
| strict-transport-security: max-age=31536000; includeSubdomains | ||
| x-frame-options: SAMEORIGIN | ||
| x-xss-protection: 1; mode=block | ||
| x-content-type-options: nosniff | ||
| content-security-policy: default-src 'self' | ||
| x-content-security-policy: default-src 'self' | ||
| x-webkit-csp: default-src 'self' | ||
| cache-control: no-cache, no-store, must-revalidate | ||
| pragma: no-cache | ||
| expires: '0' | ||
| access-control-allow-origin: '*' | ||
| access-control-allow-methods: GET, HEAD, OPTIONS | ||
| x-cache: Miss from cloudfront | ||
| via: 1.1 05aec04162b0fed6e9762cd1edd66a72.cloudfront.net (CloudFront) | ||
| x-amz-cf-pop: SFO5-C1 | ||
| x-amz-cf-id: 6igBEZiS6YVFOwoV_yLO6HPn-99tRmQUnhtoh_Swed2DPMG6mDJC9g== | ||
| body: | ||
| encoding: UTF-8 | ||
| file: no | ||
| string: '{}' | ||
| recorded_at: 2021-12-17 13:18:17 GMT | ||
| recorded_with: vcr/1.0.2, webmockr/0.8.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| http_interactions: | ||
| - request: | ||
| method: get | ||
| uri: https://api.binance.com/api/v3/ticker/bookTicker?symbol=ETHUSDT | ||
| body: | ||
| encoding: '' | ||
| string: '' | ||
| headers: | ||
| Accept: application/json, text/xml, application/xml, */* | ||
| response: | ||
| status: | ||
| status_code: 200 | ||
| category: Success | ||
| reason: OK | ||
| message: 'Success: (200) OK' | ||
| headers: | ||
| content-type: application/json;charset=UTF-8 | ||
| content-length: '118' | ||
| date: Fri, 17 Dec 2021 17:55:53 GMT | ||
| server: nginx | ||
| x-mbx-uuid: 8ec69e91-5353-431e-93db-f2a3ac570b73 | ||
| x-mbx-used-weight: '1' | ||
| x-mbx-used-weight-1m: '1' | ||
| strict-transport-security: max-age=31536000; includeSubdomains | ||
| x-frame-options: SAMEORIGIN | ||
| x-xss-protection: 1; mode=block | ||
| x-content-type-options: nosniff | ||
| content-security-policy: default-src 'self' | ||
| x-content-security-policy: default-src 'self' | ||
| x-webkit-csp: default-src 'self' | ||
| cache-control: no-cache, no-store, must-revalidate | ||
| pragma: no-cache | ||
| expires: '0' | ||
| access-control-allow-origin: '*' | ||
| access-control-allow-methods: GET, HEAD, OPTIONS | ||
| x-cache: Miss from cloudfront | ||
| via: 1.1 216f781ed7a0653429ac7a72888ca4c5.cloudfront.net (CloudFront) | ||
| x-amz-cf-pop: SFO5-C1 | ||
| x-amz-cf-id: 3JM6LD41Aumf2wX4ODWF7SCr26luLMzJoZbBbEPqHOjVWObWeWrK-Q== | ||
| body: | ||
| encoding: UTF-8 | ||
| file: no | ||
| string: '{"symbol":"ETHUSDT","bidPrice":"3847.76000000","bidQty":"0.08410000","askPrice":"3847.77000000","askQty":"3.08740000"}' | ||
| recorded_at: 2021-12-17 17:55:53 GMT | ||
| recorded_with: vcr/1.0.2, webmockr/0.8.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| http_interactions: | ||
| - request: | ||
| method: get | ||
| uri: https://api.binance.com/api/v3/ticker/price?symbol=ETHUSDT | ||
| body: | ||
| encoding: '' | ||
| string: '' | ||
| headers: | ||
| Accept: application/json, text/xml, application/xml, */* | ||
| response: | ||
| status: | ||
| status_code: 200 | ||
| category: Success | ||
| reason: OK | ||
| message: 'Success: (200) OK' | ||
| headers: | ||
| content-type: application/json;charset=UTF-8 | ||
| content-length: '44' | ||
| date: Fri, 17 Dec 2021 17:25:28 GMT | ||
| server: nginx | ||
| x-mbx-uuid: 5789ff6e-9cdf-4957-9816-b428ebbb5852 | ||
| x-mbx-used-weight: '1' | ||
| x-mbx-used-weight-1m: '1' | ||
| strict-transport-security: max-age=31536000; includeSubdomains | ||
| x-frame-options: SAMEORIGIN | ||
| x-xss-protection: 1; mode=block | ||
| x-content-type-options: nosniff | ||
| content-security-policy: default-src 'self' | ||
| x-content-security-policy: default-src 'self' | ||
| x-webkit-csp: default-src 'self' | ||
| cache-control: no-cache, no-store, must-revalidate | ||
| pragma: no-cache | ||
| expires: '0' | ||
| access-control-allow-origin: '*' | ||
| access-control-allow-methods: GET, HEAD, OPTIONS | ||
| x-cache: Miss from cloudfront | ||
| via: 1.1 bff12d4943c1f6f79b908f484a63c7f4.cloudfront.net (CloudFront) | ||
| x-amz-cf-pop: SFO5-C1 | ||
| x-amz-cf-id: ODJiMevObu8IKjILik6ceNCOt7Sk-9P4qII_NLeEvhjhu03VjnPfCA== | ||
| body: | ||
| encoding: UTF-8 | ||
| file: no | ||
| string: '{"symbol":"ETHUSDT","price":"3866.44000000"}' | ||
| recorded_at: 2021-12-17 17:25:28 GMT | ||
| recorded_with: vcr/1.0.2, webmockr/0.8.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| http_interactions: | ||
| - request: | ||
| method: get | ||
| uri: https://api.binance.com/api/v1/aggTrades?symbol=ETHUSDT&limit=2 | ||
| body: | ||
| encoding: '' | ||
| string: '' | ||
| headers: | ||
| Accept: application/json, text/xml, application/xml, */* | ||
| response: | ||
| status: | ||
| status_code: 200 | ||
| category: Success | ||
| reason: OK | ||
| message: 'Success: (200) OK' | ||
| headers: | ||
| content-type: application/json;charset=UTF-8 | ||
| content-length: '237' | ||
| date: Fri, 17 Dec 2021 16:43:02 GMT | ||
| server: nginx | ||
| x-mbx-uuid: f18ad480-f11a-41f8-a01d-d5b47c6c865e | ||
| x-mbx-used-weight: '1' | ||
| x-mbx-used-weight-1m: '1' | ||
| strict-transport-security: max-age=31536000; includeSubdomains | ||
| x-frame-options: SAMEORIGIN | ||
| x-xss-protection: 1; mode=block | ||
| x-content-type-options: nosniff | ||
| content-security-policy: default-src 'self' | ||
| x-content-security-policy: default-src 'self' | ||
| x-webkit-csp: default-src 'self' | ||
| cache-control: no-cache, no-store, must-revalidate | ||
| pragma: no-cache | ||
| expires: '0' | ||
| access-control-allow-origin: '*' | ||
| access-control-allow-methods: GET, HEAD, OPTIONS | ||
| x-cache: Miss from cloudfront | ||
| via: 1.1 05aec04162b0fed6e9762cd1edd66a72.cloudfront.net (CloudFront) | ||
| x-amz-cf-pop: SFO5-C1 | ||
| x-amz-cf-id: Ubkw3eaurWKWcgWjRmc-rGlqUnFn2eNzuazRiOk2YF-lD45O6zyhCg== | ||
| body: | ||
| encoding: UTF-8 | ||
| file: no | ||
| string: '[{"a":579794207,"p":"3910.67000000","q":"0.91590000","f":710227286,"l":710227287,"T":1639759381993,"m":false,"M":true},{"a":579794208,"p":"3910.68000000","q":"0.09410000","f":710227288,"l":710227289,"T":1639759381993,"m":false,"M":true}]' | ||
| recorded_at: 2021-12-17 16:43:02 GMT | ||
| recorded_with: vcr/1.0.2, webmockr/0.8.0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.