A Python framework for interacting with Solana's Pyth network.

Related tags

Networkingpythpy
Overview

Pyth Network

A basic Python framework for reading and decoding data regarding the Pyth network oracles.

Install

pip3 install pythpy

Setup

import pythpy
from solana.rpc.api import Client

# use a Solana client to get Pyth oracle data
solana_client = Client(
    endpoint='https://api.mainnet-beta.solana.com',
    commitment='confirmed'
)
# public address for the Pyth SOL oracle
sol_oracle_address = 'H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG'
oracle_account_info = pythpy.call_oracle_account(
    client=solana_client, 
    address=sol_oracle_address
)
# view the info
print(oracle_account_info)

Output:

{
    "magic": 2712847316,
    "version": 2,
    "oracle_type": 3,
    "size": 1872,
    "price_type": 1,
    "exponent": -8,
    "num_component_prices": 17,
    "num_quoters": 15,
    "last_slot": 109163611,
    "valid_slot": 109163610,
    "twap": {
        "value": 188.081046,
        "fraction": {
            "numerator": 4446404127,
            "denominator": 2364089437
        }
    },
    "twac": {
        "value": 0.10387786,
        "fraction": {
            "numerator": 2455765564,
            "denominator": 2364089437
        }
    },
    "drv1": 1e-08,
    "drv2": 3e-08,
    "product_account_key": "ALP8SdU9oARYVLgLR7LrqMNCYBnhtnQz1cj6bwgwQmgj",
    "next_price_account_key": "11111111111111111111111111111111",
    "previous_slot": 109163609,
    "previous_price": 189.912598,
    "previous_confidence": 0.142106,
    "drv3": 0.0,
    "aggregate": {
        "price": 189.914705,
        "confidence": 0.15314,
        "status": 1,
        "corporate_action": 0,
        "publish_slot": 109163611
    },
    "price_components": [
        {
            "price": 189.922,
            "confidence": 0.074,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163603
        },
        {
            "price": 189.9655,
            "confidence": 0.0695,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        },
        {
            "price": 189.9125,
            "confidence": 0.03348694,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163603
        },
        {
            "price": 189.9125,
            "confidence": 0.03348694,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163603
        },
        {
            "price": 189.801,
            "confidence": 0.0075,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163604
        },
        {
            "price": 189.801,
            "confidence": 0.0075,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163604
        },
        {
            "price": 189.90375,
            "confidence": 0.0875,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163604
        },
        {
            "price": 189.90375,
            "confidence": 0.0875,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163604
        },
        {
            "price": 189.8,
            "confidence": 0.22,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163604
        },
        {
            "price": 189.8,
            "confidence": 0.22,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163604
        },
        {
            "price": 189.94324999,
            "confidence": 0.0945,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163603
        },
        {
            "price": 189.94975,
            "confidence": 0.0945,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163604
        },
        {
            "price": 189.9695,
            "confidence": 0.0915,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163592
        },
        {
            "price": 189.8795,
            "confidence": 0.0915,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163604
        },
        {
            "price": 189.945,
            "confidence": 0.224,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        },
        {
            "price": 189.945,
            "confidence": 0.224,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        },
        {
            "price": 190.00769337,
            "confidence": 0.09500384,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        },
        {
            "price": 190.00769337,
            "confidence": 0.09500384,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        },
        {
            "price": 189.9665,
            "confidence": 0.08199159,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163603
        },
        {
            "price": 189.9665,
            "confidence": 0.08199159,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163603
        },
        {
            "price": 189.9175,
            "confidence": 0.0328868,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163603
        },
        {
            "price": 189.9175,
            "confidence": 0.0328868,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163603
        },
        {
            "price": 189.94345807,
            "confidence": 0.09032811,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        },
        {
            "price": 189.94345807,
            "confidence": 0.09032811,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        },
        {
            "price": 189.94001131,
            "confidence": 0.12145504,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        },
        {
            "price": 189.94001131,
            "confidence": 0.12145504,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        },
        {
            "price": 189.90292767,
            "confidence": 0.08596382,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163603
        },
        {
            "price": 189.90292767,
            "confidence": 0.08596382,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163603
        },
        {
            "price": 189.95925,
            "confidence": 0.32675,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        },
        {
            "price": 189.95925,
            "confidence": 0.32675,
            "status": 1,
            "corporate_action": 0,
            "publish_slot": 109163605
        }
    ]
}
Visualize the electric field of a point charge network.

ElectriPy ⚡ Visualize the electric field of a point charges network. 🔌 Installation Install ElectriPy package: $ pip install electripy You are all d

Dylan Tintenfich 29 Aug 29, 2022
CloudProxy is to hide your scrapers IP behind the cloud

Hide your scrapers IP behind the cloud. Provision proxy servers across different cloud providers to improve your scraping success.

Christian Laffin 1.1k Jan 02, 2023
Learn how modern web applications and microservice architecture work as you complete a creative assignment

Micro-service Создание микросервиса Цель работы Познакомиться с механизмом работы современных веб-приложений и микросервисной архитектуры в процессе в

Григорий Верховский 1 Dec 19, 2021
Python implementation of the IPv8 layer provide authenticated communication with privacy

Python implementation of the IPv8 layer provide authenticated communication with privacy

203 Oct 26, 2022
School Project using Python Sockets and Personal Encryption Method.

Python-Secure-File-Transfer School Project using Python Sockets and Personal Encryption Method. Installation Must have python3 installed on your syste

1 Dec 03, 2021
Aiotor - a pool of proxies, shifting on each request

Aiotor - a pool of proxies, shifting on each request

Leon 32 Dec 26, 2022
A Simplest TCP client and echo server

Простейшие TCP-клиент и эхо-сервер Цель работы Познакомиться с приемами работы с сетевыми сокетами в языке программирования Python. Задания для самост

Юля Нагубнева 1 Oct 25, 2021
This program ingests a Cisco "sh ip arp" as a text file and produces the list of vendors seen in the file

IP-ARP-Vendor_lookup This program ingests a Cisco "sh ip arp" as a text file and produces the list of vendors seen in the file Why? Answers the questi

Stew Alexander 1 Dec 24, 2022
A website to list Shadowsocks proxies and check them periodically

Shadowmere An automatically tested list of Shadowsocks proxies. Motivation Collecting proxies around the internet is fun, but what if they stop workin

Jorge Alberto Díaz Orozco (Akiel) 29 Dec 21, 2022
Share clipboards between two devices in a network

Shared Clipboard I felt the need for sharing clipboard texts between virtual machines but I didn't find any reliable solutions for this (I use HyperV)

Teja Swaroop 9 Jun 10, 2022
A Project to resolve hostname and receive IP

hostname-resolver A Project to resolve hostname and receive IP Installation git clone https://github.com/ihapiw/hostname-resolver.git Head into the ho

iHapiW 5 Sep 12, 2022
Pteronode - Script for managing Pterodactyl nodes

pteronode Script for managing Pterodactyl nodes Pteronode allows you to create s

9 Sep 28, 2022
Impacket is a collection of Python classes for working with network protocols.

What is Impacket? Impacket is a collection of Python classes for working with network protocols. Impacket is focused on providing low-level programmat

SecureAuth Corporation 10.4k Jan 09, 2023
Use Raspberry Pi and CircuitSetup's power monitor hardware to publish electrical usage to MQTT

This repo has code and notes for whole home electrical power monitoring using a Raspberry Pi and CircuitSetup modules. Beyond just collecting data, it

Eric Tsai 10 Jul 25, 2022
DNS monitoring system built with Python.

DNS monitoring system built with Python.

Andressa Cabistani 7 Sep 28, 2021
SocksFlood, a DoS tools that sends attacks using Socks5 & Socks4

Information SocksFlood, a DoS tools that sends attacks using Socks5 and Socks4 Requirements Python 3.10.0 A little bit knowledge of sockets IDE / Code

ArtemisID 0 Dec 03, 2021
Throttle rTorrent on Plex stream Start/Stop

Dependencies Python 3.6+ Tautulli Script Setup Edit rtorrent_throttle.py and set rTorrent username, password and RPC2 url. Tautulli Setup Commum Scrip

4 Apr 25, 2022
Dnspython is a DNS toolkit for Python.

dnspython is a DNS toolkit for Python. It supports almost all record types. It can be used for queries, zone transfers, and dynamic updates. It supports TSIG authenticated messages and EDNS0.

Bob Halley 2.1k Jan 06, 2023
A powerful framework for decentralized federated learning with user-defined communication topology

Scatterbrained Decentralized Federated Learning Scatterbrained makes it easy to build federated learning systems. In addition to traditional federated

Johns Hopkins Applied Physics Laboratory 7 Sep 26, 2022
A Python server and client app that tracks player session times and server status

MC Outpost A Python server and client application that tracks player session times and server status About MC Outpost provides a session graph and ser

Grant Scrits 0 Jul 23, 2021