ripple / rippled-historical-database

SQL database as a canonical source of historical data
99 stars 68 forks source link

Exchange computation #149

Closed Try-Parser closed 7 years ago

Try-Parser commented 7 years ago

is there any way i can parse exchange through transaction ? subscribe command? using the websocket command ? or is there any way to compute it without using data api v2 ? hoping for some answer i would really appreciate it .. thanks..

shekenahglory commented 7 years ago

this is the code that extracts exchanges from a transaction: https://github.com/ripple/rippled-historical-database/blob/develop/lib/ledgerParser/exchanges.js

Try-Parser commented 7 years ago

@shekenahglory thanks for your reply.

yeah i use that code but that code is not suitable for the transaction raw data where can i find the data for that code ? it accept transaction but using trasaction.metaData but in the transaction data it has transaction.meta and i tried to change it but no hope..

shekenahglory commented 7 years ago

meta and metadata should be the same data, just named differently - the metadata is the raw data of the transaction showing what has changed because of that transaction

Try-Parser commented 7 years ago

{"engine_result":"tesSUCCESS","engine_result_code":0,"engine_result_message":"The transaction was applied. Only final in a validated ledger.","ledger_hash":"0CCEDC2E106832CD74C98267E1E4027E0310D85D15DB2E3D3301D969AE5AC4B7","ledger_index":30681787,"meta":{"AffectedNodes":[{"ModifiedNode":{"FinalFields":{"Account":"rKiXzDZd8jDNVSUe31QafzsAnt2pGi4UNz","Balance":"91979220668","Flags":0,"OwnerCount":5,"Sequence":152351},"LedgerEntryType":"AccountRoot","LedgerIndex":"06C83FE867A3FC68E318600B5D67BE8CB0B7DA43DEF687CCAFCB8F2524AE56CE","PreviousFields":{"Balance":"90798116512","OwnerCount":6,"Sequence":152350},"PreviousTxnID":"C8F25599B73B3AA9B9C2D3FFBF6E6FBFA8A4D7B88F6471AF2FC155F9C7862F33","PreviousTxnLgrSeq":30681787}},{"ModifiedNode":{"FinalFields":{"Flags":0,"IndexPrevious":"0000000000000428","Owner":"rB3gZey7VWHYRqJHLoHDEJXJ2pEPNieKiS","RootIndex":"5E57FEC97EA6A8F8CB9EAF25669F7B8BCEC18B95A38D28CBAC9CFB78657C9F96"},"LedgerEntryType":"DirectoryNode","LedgerIndex":"0745D7452779D7ABDF1362A76FEEEEEBEE749E29D137E9FAC3D3814C04886B40"}},{"ModifiedNode":{"FinalFields":{"Account":"r3sFkDjoSisbwNEABjTtzEyUh3nmw1ZpYu","Balance":"7789570887","Flags":0,"OwnerCount":16,"Sequence":1301},"LedgerEntryType":"AccountRoot","LedgerIndex":"16162333CF1B69B173B606A79F44D5BE4CF688BEFCD721968C3871236F33E5E6","PreviousFields":{"Balance":"8970688043"},"PreviousTxnID":"4D3DBD6E00F3DC95038FFB1130B3F3CAE0A5A9A24C5382C4B95AFACD87045310","PreviousTxnLgrSeq":30681654}},{"ModifiedNode":{"FinalFields":{"Balance":{"currency":"JPY","issuer":"rrrrrrrrrrrrrrrrrrrrBZbvji","value":"834152.0956733603"},"Flags":1114112,"HighLimit":{"currency":"JPY","issuer":"rB3gZey7VWHYRqJHLoHDEJXJ2pEPNieKiS","value":"0"},"HighNode":"000000000000024B","LowLimit":{"currency":"JPY","issuer":"r3sFkDjoSisbwNEABjTtzEyUh3nmw1ZpYu","value":"10000000000"},"LowNode":"0000000000000000"},"LedgerEntryType":"RippleState","LedgerIndex":"1E420C4C3E1AD09F60300E5D63D6DB142ADEDF5AC033F06C7E8F93A79F88D1B2","PreviousFields":{"Balance":{"currency":"JPY","issuer":"rrrrrrrrrrrrrrrrrrrrBZbvji","value":"797100.4504737687"}},"PreviousTxnID":"EF8E5B97E51B41CCE76387BF622FD598CA650EE306964BEA4E32427F461FA0B8","PreviousTxnLgrSeq":30681650}},{"ModifiedNode":{"LedgerEntryType":"AccountRoot","LedgerIndex":"2C6F7594FB7471F4983C2BC691AAC2F25F8DB88D455985B4181E053D7AB23006","PreviousTxnID":"C8F25599B73B3AA9B9C2D3FFBF6E6FBFA8A4D7B88F6471AF2FC155F9C7862F33","PreviousTxnLgrSeq":30681787}},{"ModifiedNode":{"FinalFields":{"Account":"r3sFkDjoSisbwNEABjTtzEyUh3nmw1ZpYu","BookDirectory":"11EEBF7DFC0076D299322039F1493C921CAAEFE85B322E5D500B2515BAA91000","BookNode":"0000000000000000","Flags":131072,"OwnerNode":"0000000000000000","Sequence":1299,"TakerGets":"318882844","TakerPays":{"currency":"JPY","issuer":"rB3gZey7VWHYRqJHLoHDEJXJ2pEPNieKiS","value":"10003.35480040833"}},"LedgerEntryType":"Offer","LedgerIndex":"822370BEFFA74AE545B9A21E86A5C5A85EAF631A86912AD0CB030E12D31BBC9C","PreviousFields":{"TakerGets":"1500000000","TakerPays":{"currency":"JPY","issuer":"rB3gZey7VWHYRqJHLoHDEJXJ2pEPNieKiS","value":"47055"}},"PreviousTxnID":"EF8E5B97E51B41CCE76387BF622FD598CA650EE306964BEA4E32427F461FA0B8","PreviousTxnLgrSeq":30681650}},{"DeletedNode":{"FinalFields":{"Balance":{"currency":"JPY","issuer":"rrrrrrrrrrrrrrrrrrrrBZbvji","value":"0"},"Flags":2097152,"HighLimit":{"currency":"JPY","issuer":"rKiXzDZd8jDNVSUe31QafzsAnt2pGi4UNz","value":"0"},"HighNode":"0000000000000002","LowLimit":{"currency":"JPY","issuer":"rB3gZey7VWHYRqJHLoHDEJXJ2pEPNieKiS","value":"0"},"LowNode":"0000000000000429","PreviousTxnID":"C8F25599B73B3AA9B9C2D3FFBF6E6FBFA8A4D7B88F6471AF2FC155F9C7862F33","PreviousTxnLgrSeq":30681787},"LedgerEntryType":"RippleState","LedgerIndex":"89E35CD61388F58ABA3715C8A4B95C8E3DD966DFBCFEC0822A97C120D3A3A095","PreviousFields":{"Balance":{"currency":"JPY","issuer":"rrrrrrrrrrrrrrrrrrrrBZbvji","value":"-37125.74848999086"},"Flags":2228224}}},{"ModifiedNode":{"FinalFields":{"Flags":0,"IndexPrevious":"0000000000000000","Owner":"rKiXzDZd8jDNVSUe31QafzsAnt2pGi4UNz","RootIndex":"15013781849BAD70BFC99A470B54203CBBDAEE4DB066D1705CDC0621CCD71F97"},"LedgerEntryType":"DirectoryNode","LedgerIndex":"C441C96329AF910923423EF421670059C7282A5FF3702C2D0A8BBEEF30931113"}}],"TransactionIndex":5,"TransactionResult":"tesSUCCESS"},"status":"closed","transaction":{"Account":"rKiXzDZd8jDNVSUe31QafzsAnt2pGi4UNz","Fee":"13000","Flags":2147483648,"LastLedgerSequence":30681788,"Sequence":152350,"SigningPubKey":"03EC6CC6B651BD770E1968F717FB30ADF4FA00A3D045236DC841A6DEFED88C8001","TakerGets":{"currency":"JPY","issuer":"rB3gZey7VWHYRqJHLoHDEJXJ2pEPNieKiS","value":"37203.71998696954"},"TakerPays":"1185846349","TransactionType":"OfferCreate","TxnSignature":"3045022100C445E1EDF88E17049BBCC822781F8AFC5D881039EF89DBC9084298A624AC7309022066D27CEF0EC9DDAED3229C785C0A5B9305AFF5BE31E53F1ED34B8BB8399FF958","date":551416212,"hash":"0DF64DD17F37B9770D65C5395106628EE059B26D3AA965BFF26E489D355FDD63","owner_funds":"0"},"type":"transaction","validated":true}

that code is on stream subscribe transactions but its different data i think that data is not match whit the code of exchange.js is there any source of data that fits with the code ?