Bitcoin Forum
March 28, 2024, 10:01:13 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [17] 18 19 20 »  All
  Print  
Author Topic: [Nxt] API of Nxt  (Read 37208 times)
l8orre
Legendary
*
Offline Offline

Activity: 1181
Merit: 1018


View Profile
February 10, 2014, 06:56:25 AM
 #321

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


1711620073
Hero Member
*
Offline Offline

Posts: 1711620073

View Profile Personal Message (Offline)

Ignore
1711620073
Reply with quote  #2

1711620073
Report to moderator
1711620073
Hero Member
*
Offline Offline

Posts: 1711620073

View Profile Personal Message (Offline)

Ignore
1711620073
Reply with quote  #2

1711620073
Report to moderator
1711620073
Hero Member
*
Offline Offline

Posts: 1711620073

View Profile Personal Message (Offline)

Ignore
1711620073
Reply with quote  #2

1711620073
Report to moderator
"You Asked For Change, We Gave You Coins" -- casascius
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
February 10, 2014, 07:28:39 AM
 #322

Since when has that been in  Shocked  Huh

~1 week
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 10, 2014, 12:45:15 PM
 #323

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.
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
February 10, 2014, 01:10:13 PM
 #324

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.
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 10, 2014, 02:16:28 PM
 #325

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?
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 10, 2014, 03:01:27 PM
 #326

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=...
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 10, 2014, 05:13:49 PM
 #327

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?
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
February 10, 2014, 06:17:31 PM
 #328

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.
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 10, 2014, 06:27:44 PM
 #329

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?
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
February 10, 2014, 06:30:28 PM
 #330

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.
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 11, 2014, 01:11:16 PM
 #331


These

http://holms.cloudapp.net:6874/nxt?requestType=getAskOrderIds&asset=14714270022348648277&timestamp=6829746
http://holms.cloudapp.net:6874/nxt?requestType=getAskOrderIds&asset=14714270022348648277&timestamp=20000
http://holms.cloudapp.net:6874/nxt?requestType=getAskOrderIds&asset=14714270022348648277&timestamp=0

all return the same AskOrderIds. Is the timestamp parameter ignored?
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
February 11, 2014, 01:13:48 PM
 #332


Yes
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 12, 2014, 11:52:28 AM
 #333

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?

Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
February 12, 2014, 11:56:13 AM
 #334

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

In cents.
xchrix
Hero Member
*****
Offline Offline

Activity: 905
Merit: 1001



View Profile
February 12, 2014, 12:57:00 PM
 #335

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 office@cryptocoincharts.info if you want to help.
thank and keep up the good work!!!
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 12, 2014, 02:27:37 PM
 #336

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 office@cryptocoincharts.info 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.
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 12, 2014, 02:31:04 PM
 #337

I was trying to get the account number of buyers and sellers by calling  getAskOrder/getBidOrder on the orderIDs that are returned with getTrades, but they are no longer available.

Fullfilled orders are immediately deleted from the system, right? So no way to show the seller and buyer account for a trade?
bitcoinpaul
Hero Member
*****
Offline Offline

Activity: 910
Merit: 1000



View Profile
February 12, 2014, 03:32:50 PM
 #338

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 office@cryptocoincharts.info if you want to help.
thank and keep up the good work!!!

Very nice!

https://bitcointalk.org/index.php?topic=345619.msg5101634#msg5101634
xchrix
Hero Member
*****
Offline Offline

Activity: 905
Merit: 1001



View Profile
February 12, 2014, 04:33:35 PM
 #339

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 office@cryptocoincharts.info if you want to help.
thank and keep up the good work!!!

Very nice!

https://bitcointalk.org/index.php?topic=345619.msg5101634#msg5101634

thx. sent a message Smiley
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
February 12, 2014, 04:36:20 PM
 #340

Fullfilled orders are immediately deleted from the system, right? So no way to show the seller and buyer account for a trade?

Right. Use getTransaction and feed orderId as transactionId.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [17] 18 19 20 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!