forked from tiagosiebler/binance
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request tiagosiebler#438 from tiagosiebler/autoinvest
v2.12.2: fix() auto invest endpoints params error
- Loading branch information
Showing
5 changed files
with
119 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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,57 @@ | ||
import { MainClient } from '../src/index'; | ||
|
||
// or | ||
// import { MainClient } from 'binance'; | ||
|
||
const key = process.env.API_KEY_COM || 'APIKEY'; | ||
const secret = process.env.API_SECRET_COM || 'APISECRET'; | ||
|
||
const client = new MainClient({ | ||
api_key: key, | ||
api_secret: secret, | ||
beautifyResponses: true, | ||
}); | ||
|
||
(async () => { | ||
try { | ||
const oneTimeTransactionResult = | ||
await client.submitAutoInvestOneTimeTransaction({ | ||
sourceType: 'MAIN_SITE', | ||
subscriptionAmount: 100, | ||
sourceAsset: 'USDT', | ||
details: [ | ||
{ | ||
targetAsset: 'BTC', | ||
percentage: 60, | ||
}, | ||
{ | ||
targetAsset: 'ETH', | ||
percentage: 40, | ||
}, | ||
], | ||
}); | ||
|
||
console.log('oneTimeTransactionResult', oneTimeTransactionResult); | ||
|
||
const autoInvestPlanResult = await client.submitAutoInvestmentPlan({ | ||
UID: '20983262a', | ||
sourceType: 'MAIN_SITE', | ||
subscriptionAmount: 100, | ||
sourceAsset: 'USDT', | ||
planType: 'SINGLE', | ||
flexibleAllowedToUse: true, | ||
subscriptionCycle: 'DAILY', | ||
subscriptionStartTime: 5, | ||
details: [ | ||
{ | ||
targetAsset: 'BTC', | ||
percentage: 100, | ||
}, | ||
], | ||
}); | ||
|
||
console.log('autoInvestPlanResult', autoInvestPlanResult); | ||
} catch (e) { | ||
console.error('request failed: ', e); | ||
} | ||
})(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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