Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

How to place an order to buy AND sell #6

Open
spapapan opened this issue Jan 6, 2018 · 2 comments
Open

How to place an order to buy AND sell #6

spapapan opened this issue Jan 6, 2018 · 2 comments
Labels

Comments

@spapapan
Copy link

spapapan commented Jan 6, 2018

In your code example you explain how to trade BTC with ETH, but how to trade ETH with BTC?

@spapapan
Copy link
Author

spapapan commented Jan 6, 2018

Maybe in this line

BinanceOrderPlacement placement = new BinanceOrderPlacement(symbol, BinanceOrderSide.BUY);

to switch you can use

BinanceOrderPlacement placement = new BinanceOrderPlacement(symbol, BinanceOrderSide.SELL);

?

@wcrbrm wcrbrm added the question label Jan 6, 2018
@wcrbrm
Copy link
Member

wcrbrm commented Jan 6, 2018

hi @spapapan
Whether you are buying or you are selling - it depends on the market symbol.
on a market there is usually a base asset and there is asset that you are trading against.

When you are looking at ETHBTC market symbol, that means ETH would be bought. and ETH would be sold - and the last part of the symbol is the base asset.

so, if you want to buy ETH for BTC, you are doing

new BinanceOrderPlacement(new BinanceSymbol("ETHBTC"), BinanceOrderSide.BUY);

and if you want to sell ETH for BTC, you are doing

new BinanceOrderPlacement(new BinanceSymbol("ETHBTC"), BinanceOrderSide.SELL);

Hope that makes it a bit more clear for you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants