-
Notifications
You must be signed in to change notification settings - Fork 86
API
zjubfd edited this page Jan 5, 2023
·
2 revisions
- Create Wallet From Mnemonic Code Example:
List<String> mnemonicCodeWords = Crypto.generateMnemonicCode();
wallet = Wallet.createWalletFromMnemonicCode(mnemonicCodeWords, BinanceDexEnvironment.TEST_NET);
- Create Rest Server Example:
BinanceDexApiRestClient client = BinanceDexApiClientFactory.newInstance().newRestClient(BinanceDexEnvironment.TEST_NET.getBaseUrl());
- Create Order
NewOrder no = new NewOrder();
no.setTimeInForce(TimeInForce.GTE);
no.setOrderType(OrderType.LIMIT);
no.setSide(OrderSide.BUY);
no.setPrice("10.7");
no.setQuantity("100.0");
no.setSymbol(symbol);
- Send Order
TransactionOption options = TransactionOption.DEFAULT_INSTANCE;
List<TransactionMetadata> resp = client.newOrder(no, wallet, options, true);
- Create Vote
Vote vote = new Vote();
vote.setOption(1);
vote.setProposalId(347L);
- Send Vote
List<TransactionMetadata> resp = client.vote(vote,wallet,options,true);
- Create Synchronize Rest Server
BinanceDexApiRestClient client = BinanceDexApiClientFactory.newInstance().newRestClient(BinanceDexEnvironment.TEST_NET.getBaseUrl());
- Query Account
Account account = client.getAccount("tbnb16hywxpvvkaz6cecjz89mf2w0da3vfeg6z6yky2");
- Query Account Sequence
AccountSequence accountSequence =
client.getAccountSequence("tbnb16hywxpvvkaz6cecjz89mf2w0da3vfeg6z6yky2")
OrderBook orderBook = client.getOrderBook("ADA.B-B63_BNB", 5);
- Create Asynchronize Rest Server
BinanceDexApiAsyncRestClient client =
BinanceDexApiClientFactory.newInstance().newAsyncRestClient(BinanceDexEnvironment.TEST_NET.getBaseUrl());
- Query Account
client.getAccount("tbnb16hywxpvvkaz6cecjz89mf2w0da3vfeg6z6yky2",response -> System.out.println(response));
- Query Account Sequence
client.getAccountSequence("tbnb16hywxpvvkaz6cecjz89mf2w0da3vfeg6z6yky2",response -> System.out.println(response));
- Query Order Book
client.getOrderBook("ADA.B-B63_BNB", 5, response -> System.out.println(response));