Pages:
Author

Topic: [Nxt] API of Nxt - page 4. (Read 37374 times)

full member
Activity: 224
Merit: 100
February 12, 2014, 09:27:37 AM
guys i am a huge fan of NXT and saw that the asset exchange feature is coming alive!
checked the API documentation and looks like its easy to get a list of assets, their orderbook and the trades.
i want to make a completely new section on cryptocoincharts.info . beside cryptocoins and exchanges i want to show charts for assets. and i want to start with NXT assets as a promotion.

is somebody here willing to help me implementing this? i dont have deep knowledge of the NXT api so it would be good if somebody could implement the cronjobs which are polling the orderbook/trades of an asset and my part is doing the charts and info pages.
please contact me at [email protected] if you want to help.
thank and keep up the good work!!!

Sorry Chris, but I have no time left currently. I hope somebody else can jump in and help you.
hero member
Activity: 905
Merit: 1001
February 12, 2014, 07:57:00 AM
guys i am a huge fan of NXT and saw that the asset exchange feature is coming alive!
checked the API documentation and looks like its easy to get a list of assets, their orderbook and the trades.
i want to make a completely new section on cryptocoincharts.info . beside cryptocoins and exchanges i want to show charts for assets. and i want to start with NXT assets as a promotion.

is somebody here willing to help me implementing this? i dont have deep knowledge of the NXT api so it would be good if somebody could implement the cronjobs which are polling the orderbook/trades of an asset and my part is doing the charts and info pages.
please contact me at [email protected] if you want to help.
thank and keep up the good work!!!
legendary
Activity: 2142
Merit: 1010
Newbie
February 12, 2014, 06:56:13 AM
Is this still correct or are prices in full NXT only?

In cents.
full member
Activity: 224
Merit: 100
February 12, 2014, 06:52:28 AM
From the wiki:

Place order
Places an "ask" or "bid" order for an asset onto the exchange.
Request
http://localhost:7874/nxt?
     requestType=BID_OR_ASK&
     secretPhrase=SECRET&
     asset=ASSETID&
     quantity=QTY&
     price=PRICE&
     fee=FEE&
     deadline=DEADLINE&
     referencedTransaction=REFTXID
Where:
BID_OR_ASK is either "placeAskOrder" or "placeBidOrder"
SECRET is the secret passphrase of the account issuing the transaction
ASSETID is the assetID of the asset being ordered
QTY is the amount of the asset being ordered
PRICE is the bid/ask price, expressed in Nxt-cents (i.e. "145" is "1.45 Nxt")
FEE is the fee for the transaction

Is this still correct or are prices in full NXT only?

legendary
Activity: 2142
Merit: 1010
Newbie
February 10, 2014, 01:30:28 PM
Out of curiosity:

Alice places an ask order 10 USD @ 3 NXT/USD. (Alice wants 10 USD for 30 NXT)
Bob places a bid order 10 USD @ 2 NXT/USD. (Bob sells 10 USD for 20 NXT)
No other open orders.

How does the system match these orders? 2, 3 or 2.5 NXT/USD trade price?

Price depends on order the orders confirmed.

So in the example above, if Alice's order was confirmed first, she will get 10 USD for 20 NTX?

The price will be 3 NXT.
full member
Activity: 224
Merit: 100
February 10, 2014, 01:27:44 PM
Out of curiosity:

Alice places an ask order 10 USD @ 3 NXT/USD. (Alice wants 10 USD for 30 NXT)
Bob places a bid order 10 USD @ 2 NXT/USD. (Bob sells 10 USD for 20 NXT)
No other open orders.

How does the system match these orders? 2, 3 or 2.5 NXT/USD trade price?

Price depends on order the orders confirmed.

So in the example above, if Alice's order was confirmed first, she will get 10 USD for 20 NTX?
legendary
Activity: 2142
Merit: 1010
Newbie
February 10, 2014, 01:17:31 PM
Out of curiosity:

Alice places an ask order 10 USD @ 3 NXT/USD. (Alice wants 10 USD for 30 NXT)
Bob places a bid order 10 USD @ 2 NXT/USD. (Bob sells 10 USD for 20 NXT)
No other open orders.

How does the system match these orders? 2, 3 or 2.5 NXT/USD trade price?

Price depends on order the orders confirmed.
full member
Activity: 224
Merit: 100
February 10, 2014, 12:13:49 PM
Out of curiosity:

Alice places an ask order 10 USD @ 3 NXT/USD. (Alice wants 10 USD for 30 NXT)
Bob places a bid order 10 USD @ 2 NXT/USD. (Bob sells 10 USD for 20 NXT)
No other open orders.

How does the system match these orders? 2, 3 or 2.5 NXT/USD trade price?
full member
Activity: 224
Merit: 100
February 10, 2014, 10:01:27 AM
Thanks again. So no way to implement it in a lighter way in my client.

Somewhere I read a few days ago about new API call like getBalance which returns NXT and asset balances for an account, but I can't find it any longer. What's that API call again?

Ok, found it: nxt?requestType=getAccount&account=...
full member
Activity: 224
Merit: 100
February 10, 2014, 09:16:28 AM
Thanks again. So no way to implement it in a lighter way in my client.

Somewhere I read a few days ago about new API call like getBalance which returns NXT and asset balances for an account, but I can't find it any longer. What's that API call again?
legendary
Activity: 2142
Merit: 1010
Newbie
February 10, 2014, 08:10:13 AM
What would I need to do to calculate the quantity of an asset in an account by going through the transaction list?

U can't get the correct quantity of an asset easily coz u have to emulate order matching engine.


If an asset is issued, initially the quantity of assets created belong to the account the asset was created in, right?

Right


If transferAsset is used, I can add/substract the quantity from the balance.

Yes

What if a trade happens? Will there be a "Asset transfer" transaction for the trade without transferAsset being explicilty called?

Alice places an ask order 10 USD @ 2 NXT/USD. Her USD asset balance is adjusted by minus 10 USD.
Bob places a bid order 7 USD @ 2 NXT/USD. His balance is adjusted by minus 14 NXT.
System matches the orders. Alice gets +14 NXT. Bob gets +7 USD.
Alice cancels her order. Her USD asset balance is adjusted by plus 3 USD.

No an "Asset transfer" transaction happens.
full member
Activity: 224
Merit: 100
February 10, 2014, 07:45:15 AM
Quick question while getting familiar with AE API calls:

Besided showing orders, there is no way to get the actual trades that happened, right? Because I think we need a way to show the current price of an asset, don't we?

Use getTrades

That isn't in the Wiki. I'll peek into the decompiled source to get all calls.

Use asset, firstIndex and lastIndex parameters. Indices set range of trades in the history. If omitted 0 and 2^32-1 default values r used.

Thanks!

And more questions:

What would I need to do to calculate the quantity of an asset in an account by going through the transaction list?

If an asset is issued, initially the quantity of assets created belong to the account the asset was created in, right?

If transferAsset is used, I can add/substract the quantity from the balance.

What if a trade happens? Will there be a "Asset transfer" transaction for the trade without transferAsset being explicilty called?


EDIT: The attachment in an "issue asset" transaction should definetly include the assetID.
legendary
Activity: 2142
Merit: 1010
Newbie
February 10, 2014, 02:28:39 AM
Since when has that been in  Shocked  Huh

~1 week
legendary
Activity: 1181
Merit: 1018
February 10, 2014, 01:56:25 AM
Quick question while getting familiar with AE API calls:

Besided showing orders, there is no way to get the actual trades that happened, right? Because I think we need a way to show the current price of an asset, don't we?

Use getTrades

That isn't in the Wiki. I'll peek into the decompiled source to get all calls.

Use asset, firstIndex and lastIndex parameters. Indices set range of trades in the history. If omitted 0 and 2^32-1 default values r used.

Well, that is a new one to me - certainly very important function call. I'll have to include that in my client.

Since when has that been in  Shocked  Huh


legendary
Activity: 2142
Merit: 1010
Newbie
February 09, 2014, 02:26:45 PM
Quick question while getting familiar with AE API calls:

Besided showing orders, there is no way to get the actual trades that happened, right? Because I think we need a way to show the current price of an asset, don't we?

Use getTrades

That isn't in the Wiki. I'll peek into the decompiled source to get all calls.

Use asset, firstIndex and lastIndex parameters. Indices set range of trades in the history. If omitted 0 and 2^32-1 default values r used.
full member
Activity: 224
Merit: 100
February 09, 2014, 02:24:45 PM
Quick question while getting familiar with AE API calls:

Besided showing orders, there is no way to get the actual trades that happened, right? Because I think we need a way to show the current price of an asset, don't we?

Use getTrades

That isn't in the Wiki. I'll peek into the decompiled source to get all calls.

EDIT: Oh no... of course I can't... It's only in testnet, right? What other calls are in testnet that are not in production?
legendary
Activity: 2142
Merit: 1010
Newbie
February 09, 2014, 01:56:01 PM
Quick question while getting familiar with AE API calls:

Besided showing orders, there is no way to get the actual trades that happened, right? Because I think we need a way to show the current price of an asset, don't we?

Use getTrades
full member
Activity: 224
Merit: 100
February 09, 2014, 01:45:37 PM
Quick question while getting familiar with AE API calls:

Besided showing orders, there is no way to get the actual trades that happened, right? Because I think we need a way to show the current price of an asset, don't we?
Pages:
Jump to: