Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
BTC sell estimator
using System; using System.Collections.Generic; using System.Linq; namespace Rextester { public class Program { private static float amountOfUsdAvailable = 17000; // your starting USD amount private static float btc = 3.0161f /* blockfi */ + 0.6892f /* binance */ + 0.05f /* catex */; // your starting BTC amount private static float startPrice = 11200; // starting price private static float highestPrice = 100000; // price you want to be able to sell until private static float lowestPrice = 6000; // inclusive private static float buyIntervalPercent = 0.015f; // how often you want to buy as price increases private static List<float> GetPricePoints(float highPrice, float buyInterval, float lowPrice) { var prices = new List<float>(); for (float price = highPrice; price >= lowPrice; price *= (1-buyIntervalPercent)) { prices.Add(price); } return prices; } public static void Main(string[] args) { //var pricePoints = Enumerable.Range(0, 500) // .Select(co => Math.Round((highestPrice / Math.Pow((1+buyIntervalPercent), co)))) // .Where(price => price > lowestPrice) // .ToList(); var pricePoints = GetPricePoints(highestPrice, buyIntervalPercent, lowestPrice); var buyPricePoints = pricePoints.Where(price => price < startPrice).ToList(); Console.WriteLine("BUY SECTION: ({0} steps)\n", buyPricePoints.Count); float buyAmountEachInterval = amountOfUsdAvailable/buyPricePoints.Count(); foreach (float price in buyPricePoints.OrderBy(price => price)) { var btcToBuy = buyAmountEachInterval / price; Console.WriteLine(string.Format("At {0:$0} you should place an order to BUY {1:$0} ({2:0.0000} BTC).", price, buyAmountEachInterval, btcToBuy)); } Console.WriteLine("\n\n"); var sellPricePoints = pricePoints.Where(price => price > startPrice).OrderBy(price => price).ToList(); var total = sellPricePoints.Sum(); var proportions = sellPricePoints.Select(price => total / price).ToList(); var totalProp = proportions.Sum(); var sellAmounts = proportions.Select(prop => prop / totalProp * btc).ToList(); var sellEachPoint = sellAmounts[0] * sellPricePoints[0]; Console.WriteLine("SELL SECTION: ({0} steps, {1:C0} each step)\n", sellPricePoints.Count, sellEachPoint); //Console.WriteLine("Sell Amount each point: {0}", sellEachPoint); for (int i = 0; i < sellPricePoints.Count(); i++) { Console.WriteLine(string.Format("At {0:$0} you should place an order to SELL {1:0.00000} BTC ({2:$0}).", sellPricePoints[i], sellAmounts[i], sellEachPoint)); } //var output1 = string.Format("Starting with {0:0.0###} BTC and the price starting at ${1},", btc, startPrice); //var output1b = string.Format("Your account would be valued at ${0}", startAcctValue); //var output2 = string.Format("you can sell ${0} every ${1} until price reaches ${2}", valueEachSell, buySellInterval, goalPrice); //var output3 = string.Format("This will equal a total of ${0} gross proceeds.", totalCashSold); //var output4 = string.Format("Your profit would be ${0} / ${1} = {2:+0.00}%", totalCashSold, startAcctValue, profit); //Console.WriteLine(output1); //Console.WriteLine(output1b); //Console.WriteLine(output2); //Console.WriteLine(output3); //Console.WriteLine(output4); } } }
run
|
edit
|
history
|
help
0
tool
3
vttrtbrbt
random no generation array
find the index of the substring "fir" - Seeni
vera
sdfrgtyhui897ytr
bytes to string to bytes.
puzzle piezas
Async Multithreading