Thursday, August 4, 2022

Convert JSON object in to class

 https://stackoverflow.com/questions/11126242/using-jsonconvert-deserializeobject-to-deserialize-json-to-a-c-sharp-poco-class

Get the rate from Binance

 Get the rate from Binance


HTTP POST Request:

https://p2p.binance.com/bapi/c2c/v2/friendly/c2c/adv/search


Parameters:

{  "asset": "USDT",

    "fiat": "CNY",

    "merchantCheck": true,

    "page": 1,

    "payTypes": ["BANK"],

    "publisherType": null,

    "rows": 20,

    "tradeType": "BUY",

    "transAmount":  "5000"

}


Parameters:


asset: Currently available asset USDT, BTC, BNB, BUSD, ETH, DAI.


fiat: Its long, visit sanchezmarcos.


merchantCheck: Well i don't know its use, but value is null, true, false.


page: The endpoint is paginated.


payTypes: An array of payment types example BANK, GoMoney, CashDeposit etc.


payTypes depend on fiat used so you might not see some of these but there's a lot of payment types.


publisherType: I'm only aware of merchant.


row: Amount of rows from 1 - 20.


tradeType: BUY or SELL.


transAmount: Filter merchant by amount.


Note The api is for binance internal operation which means it can change any time


Ref:

https://stackoverflow.com/questions/67793326/api-binance-p2p-i-only-access-a-part-only-the-buy-and-not-all-of-it-buy-and-s

Monday, August 1, 2022

Get the text between two string with C#

 


public static string getBetween(string strSource, string strStart, string strEnd)

{

    if (strSource.Contains(strStart) && strSource.Contains(strEnd))

    {

        int Start, End;

        Start = strSource.IndexOf(strStart, 0) + strStart.Length;

        End = strSource.IndexOf(strEnd, Start);

        return strSource.Substring(Start, End - Start);

    }


    return "";

}


string source = "This is an example string and my data is here";

string data = getBetween(source, "my", "is");


Reference:

https://stackoverflow.com/questions/10709821/find-text-in-string-with-c-sharp