pyth.Network
Pyth Network price feeds provide real-time financial market data to smart contract applications on 50+ blockchains. Pyth's market data is contributed by over 95 reputable first-party data providers(opens in a new tab) , including some of the biggest exchanges and market making firms in the world. Each price feed publishes a robust aggregate of these prices multiple times per second. The protocol offers over 450 price feeds(opens in a new tab) covering a number of different asset classes, including US equities, commodities, and cryptocurrencies.
Pythnet Price Feeds are available on 40+ blockchain ecosystems , and can also be used in off-chain applications. For the DMC we use the off-chain solution to bring the feed to DMC.
Contracts
Prices
The prices can be requested by calling the method
Copy function getPrice ( bytes32 id) external view returns ( IJavPriceAggregator . Price memory price) {
return _latestPriceInfo[id];
}
The main IDs are provided by the pythNetwork and can be found here: https://pyth.network/developers/price-feed-ids
At example the id for BTC/USD is:
Copy 0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43
EMA for prices
The Exponential Moving Average (EMA) is a technical indicator used in trading practices that shows how the price of an asset or security changes over a certain period of time. The EMA is different from a simple moving average in that it places more weight on recent data points (i.e., recent prices).
Copy calculateEMA(currentValue, previousEMA) {
const smoothingFactor = 2 / (emaPeriod + 1);
const ema = (currentValue - previousEMA) * smoothingFactor + previousEMA;
return ema;
}
Javsphere Prices and IDs
We added additional ids and feeds which are not provided by Pyth
DMC
Copy DFI:0x12635656e5b860830354ee353bce5f76d17342f9dbb560e3180d878b5d53bae3
JAV:0x2c14b4d35d0e7061b86be6dd7d168ca1f919c069f54493ed09a91adabea60ce6
DUSD:0xb3b9faf5d52f4cc87ec09fd94cb22c9dc62a8c1759b2a045faae791f8771a723
Defichain DEX
Copy EEM:0x18a288a6c537025fddff7693129bcacac5374a3ebb3c5f3e91ee044a09dffb48
NVDA:9336f35d787146964ab415cab7a5b2c3f936c6a2e0663976f8069733866f7c71
COIN:0x9d2be4d814008c806d5496b25de37a50b69cf147de684c834d58cf2f3c4cd4d2
MSFT:0x9b391aa1df448548f6099f22aa6a899ff1178600d1bfe0789bd9836611f5b341
NFLX:0x998727036cef636efcff9f2bd73d90101c8c56b18e1aae1acea02484e5a9c372
VOO:0x47252fceb0a12d0509e7e488d7ab7397e055581bedcf50f30f67a8a2898a65de
FB:0xbfa7653c073665187d9b8c0eece426e3e26d3d9edaf393c30372b7dbecd111e9
DIS:0xa6808654ee52eeec740ffa7984b22f0ecddf211c4a5bc24283d72ad5a6e532eb
MCHI:0x6045beda30c426026cb67390f249a6164a90bb94e2a3b00e7df28e08b2fe4eec
MSTR:0x4eea3fac809cb4fc1ee8ecad7982610d7a55429bd770d5ed2093dab514e1f84b
INTC:0xa56ea18280ae811feedc252e67a75d3b9ba562ef0e472ec808e8725e2f748268
PYPL:0x954c15a6d8be4bca47515cec8f83205f9428d2c8212da34fef41e37e631e3e37
BRK.B:0x3218b05707eb82b65ac04df9285c29fe07ccd83b95236a859929223c6c9c8141
PG:0x471f8d2f32851a192681db555b71834c2ef7f5a23fb56c80db95d84f343658a0
KO:0x6358cc89bcd8894bc9e2e6a21488600d46e680b772b694074ec377b92996f6a5
SAP:0xf0fce6e29771bc6d928045015d2a3979b9e0833423ede8d8fa9b01286fbe2d92
GSG:0xf6bf0f66cbaf459affe9693621af3de26903dad4dbbf7671c25c3c096f2b198f
URA:0x69cf565ae91a47ea6acc1e57a2d8d83248a5113c389f1b1e5e62f5829edc2a9a
CS:0xa27fe74625701a0918639976af757fa5be877c55ce273208e563fa1b6fd543c5
AMZN:0xb929750896550d830ce9a44485a256741d3fae9abf5db289e87934b920767807
PPLT:0x56daba1efba714b750289fca8bd7b37dcae443ce00c5c903fa271d924299460f
TAN:0x0e0c932ed0c0d3e68a51bd902af4066c1a272ee89a9108bf17c8698660b83e16
XOM:0xdf2d6d066f8efe655da21011329af4e7880bf815595527a6fe16065248caa068
GOVT:0x0b7116924b924ad6959a8d0613a48f0be8dffdcc32f21010a8209d24e68425a2
GOOGL:0x95df5343c0b2c600c51ac6890472e92a9269f14e4be38b175de5a26c3ff7c385
USDT:0x5b56544cc06527ac8813c412df8bdc4f35ed64cdf6eaa38e730561e54dfc500e
USDC:0x805f69f2c7e7ab67b1b1d001763d208e970bc3bf4a894b982a11742ef2d8d66b
GME:0xbf644bcbeda048df7649ed21ac2fa9c875a2dc510a6650010a2df9da327fd6c4
DAX:0x089c3cbb19fa1854ccf382334c9da7711636fd1672dc911e601d4a167a773a46
JNJ:0xf9cb9276a1d3c7c733ac0ba7c7004121689c327de50629d45a3e4ee23060a654
ADDYY:0x673810f28eb39c1f6981c9840548800c3e07c8274b6847c3786285409d6f70d1
GS:0xff392ea1559d6493a881b421a3d3f55b810adbefc336a748dddf23af6693f5fb
TSLA:0xb4fb5c5b61599bb8109b5670314de8ab11eff17a55bf84ece7cbc8a0418b33b8
WMT:0x8fee79d00ae9a07efa7f128aface08609bb69dfe83f395c7cf72ea1b1bd290e0
UL:0x3f07c81d5d32f534d1599626d166c4b4e5daa19101596c01efd152cf7b0794dc
UNG:0x43fd995abfdf539b4c2e3568f32cdb17dacaabf15d1f6c8f163899e6a12d0c53
USO:0x1d7f0d1ebde3ed92981ba38edf6938d0d99c7325ff3a70c8ef3a8a3a381006dc
ARKX:0xd8803e9181c8cdd4d5da3975525805b51b610d9ae67244c3e71d50ed40c3e54d
XLRE:0xe3cdb9112458e5786ef1b33bb60bd14ed01d9876e996c441015f537b6c415108
VBK:0x5b16f5171b312531e11d3508e96430b280d94b3e97f417d4e47a47b4606c7c2a
XLE:0x9c142a6f3ef151381bfd21c725619eed4c03b63f0c8bf8de8e413c4a8e999543
NSRGY:0xdb21e0b99db471fd33b98b405ebeb33fc92500f352b4c0809944674831d3661b
SHEL:0x500fcb31d7a791639ab89d7cab21c3d420d2afc980b504ebe7da4741ce3a8dcb
SH:0x7234230ff6140784c62f36a5a73862b2c236cf8ba0691e27ccd2f23de2636a59
BITI:0x37ac9fc8545cc7a501049be1442372b8a3ee5150a07ea2d5c15ade1d8657fa92
EUROC:0x095a6b9183168464aa30b5c7b9b96d3b8ae3592105b9305553d2d4291e7d38ea
XCHF:0x11016a9fab52db2f214f1fbb32fa7a3d0f0d6db9142b55baa8dc469e24a4d9ed
TBF:0x82131fa4db0e5fb4f15a3378a0e5624020f8831fdddea5cec017c531baedce97
PSQ:0xfeeb274ea8fc713f76359ba32129bf46a6d3800cfe8934f8b4ef3b2911576754
TSLS:0x90db56ca286f9e86e537659b5b5a7372748b2b32df956b8ad3f3a242584503d0
SCO:0xfe37218cd8acff48d338c5694a4a6db51b3710c076714953e9149866287fc130
ABNB:0x8e868119e9cfef76991dbea76cc31d1301405dffc7d51fde4fba29d05b46ab1b
BKNG:0x0579b49727f17608e1b57fd3e81ee5d67c9dcb1c0b9a7f5d12b68c634764f0a0
JPM:0x858ae46626cacb319e8e30b4c2fe173936a374d39a36d1534466d0da1bb67cba
AI:0x0c64b2ef43d8c67d5b775231225da4468d006bb1878daaf673e75ec2dd788f66
GLNCY:0x829b24908d6a9afb13b30f92f5f5eec9063cc7ab22f6a2957cdbdfd6d41b7fec
MCD:0x07ccad0bc9532ce39fe74f207dbe2b0172a6641cddebf273bf06f73fa6ff0b97
PFE:0xdd7f9d26417dc903ff2ba1b190eb8d8e391e1a46c9124ab4076d0c70c23a35d2
SBUX:0x50eb11f64bd93ea34fb566b765b65e426ee7bf775d7695154fce1fa59f4c12e9
UBER:0x6b2d6be8bc5d516dfc7b14cacb88187f7981cf25cd45f6d40ece6a9a985db178
UPS:0xb62821151198c0d881df04d7f8de696767d2bf7e7555e21c6570d6cb28f9f89d
V:0xb222bea0673ae534d86574d4542fbeb6a3b5f3ad720fde407a0fb3a00a14bde7
ASML:0x735ca6e16e5a4256a6df7c4d27ffa329aad81b93db45f7102fef2ed463815230
SMCI:0xd360b53a685b4b9aee00ee724639b2aba3f1ebe1b5b097fb3b9ed42151f1ea34
MU:0x3b6f27fd37c9b6e10a42dd1b590e22d33469de494b6d7413e110ecdce51d850b
HOOD:0xe8a0eb4393450b31fcab7bae15b8e1c92698fac8c69788b5287c8d2ef795e788
MARA:0x06124087a6cfbfbcd3e8862bfddedf623af64539401d06ddca9df69f4cf076ed
IBIT:0x2d77a83a7ca3a803444a7fbebbd2453019c6d6f870ecefee556c050ca14b93b3
Request price
By calling the getPrice(id) method you get the following values:
Copy // Price
int64 price;
// Confidence interval around the price
uint64 conf;
// Price exponent
int32 expo;
// Unix timestamp describing when the price was published
uint64 publishTime;
With this values you can calculate the price as follows and also described here: https://docs.pyth.network/price-feeds/best-practices
Example: Price: 123673 Expo: -6 => 123673 * 10 ** -6 = 0.1236729