5

It sounds to me like you are unfamiliar with the available methods in the SDK. In addition to what Orbit Lens said, you'll need to create a transaction, sign it, and then submit it to the network. Because there aren't very many step-by-step examples out there, I'll try to "solve" this for you. Starting with the Asset. Assuming you correctly issued an asset,...


4

The OffersRequestBuilder seems like it only displays active offers. So once an order is "filled" it simply disappears. Do I need to store the offer ID and loop through active offers to check if it still exists? Yes, that's the only way so far. Effects Offer Created, Offer Updated, Offer Removed are described in API docs, but not yielded by the Horizon. ...


4

There isn't method for bulk cancelling. Stellar cancels offers by setting the Amount parameter to 0. From the site Manage Offer: Parameters [...] Amount: Amount of selling being sold. Set to 0 if you want to delete an existing offer. So, you could loop through your open orders and update the amount to 0 (cancelling them). The code below assumes that ...


3

Effects Offer Created, Offer Updated, and Offer Removed are described in API docs, but not yielded by the Horizon. Check the bug description for more details.


3

Yes, orders can be partially fulfilled. The minimum tradable amount is 0.0000001.


3

The memo is part of the transaction, it's never part of an operation. You can set a memo in any transaction no matter what kind of operations it contains, so a transaction with a memo and a manageOffer operation should work fine. You will find the reason for transaction failure in the horizon.submitTransaction calls response. It can be a bit tricky to ...


3

The price you set with manageOffer is the maximum price when buying and the minimum price when selling. So it will match the best available price in the orderbook. If you make an offer that has an immediate counterpart on the orderbook it will behave like a market order (take liquidity). If you make an offer that doesn't have an immediate counterpart in ...


3

Since there is no method for canceling all your offers in one go, you need to submit many manageOfferOp together, one for each offer. The good news is that you can submit up to 100 of this operations in one transaction. I included a script that does exactly this, first it retrieves the first page of offers you have open and creates a transaction to cancel ...


2

Have you checked the Java SDK docs? But createNonNativeAsset requires an KeyPair object. So, I'll need to find the issuing public ID of whatever asset I want to trade, and make a KeyPair? Yes, any custom asset in the Stellar network is described by code and issuer public key. Actually, there is also an asset type (AlphaNum4 or AlphaNum12), but the ...


2

This page documents the core API which takes integers. You must divide by 10^7 to get the actual numbers. All of the SDKs use strings which are the actual amounts. So the doc isn't wrong, just a bit confusing to the reader.


2

You have to provide buyAmount instead of amount in manageBuyOffer operations. The 400 error on the testnet may be cause by different reasons: no trustline, not enough funds, invalid signers, etc. Check the extras.result_codes field in the error object itself.


2

It is the MANAGE_OFFER_CROSS_SELF error described in the guides and it prevents you from unintentionally fullfilling your own previous offer: The account has opposite offer of equal or lesser price active, so the account creating this offer would immediately cross itself. You should have a look at passive offers for this case.


1

I think the underlying problem is that the number 100/9 has infinite decimal digits and cannot be represented as string. The price you see, 11.1111111 is a truncation of 11.11111111.... = 100/9. When you enter the number 11.1111111 the SDK correctly converts it to its fractional representation 111111111/10000000. The only way to get around this is to always ...


1

I think it is a feature with NodeJS. They don't go deep to reveal every detail down an object. Note the difference at console.log: offerResult.records VS offerResult server.offers('accounts', distributor.publicKey).call().then(function (offerResult) { console.log( offerResult.records ); }) gives > [ { _links: { self: [Object], offer_maker: [...


1

I found the answer. I was not representing the Assets that I need to sell properly. Replacing MCoin with new StellarSdk.Asset('MCoin', 'GCKRPJXPGNHBPMRCXEX4MDH532BN5RLUJJOMVACA3CB7E2LWSTKTB5U2') solved the problem. Ideally, an asset is Stellar is represented by its code and the issuer account Id. Final code becomes: server.loadAccount(distributor....


1

I'll attempt to answer your many questions one-by-one. Can the issuer limit/approve the counter asset that can be traded against? To make sure the asset you issue does not become part of a money laundering scheme.. Or does this require a federated approach? Federation is a separate concept from asset issuance -- not all anchors run federation ...


Only top voted, non community-wiki answers of a minimum length are eligible