Skip to content

Instantly share code, notes, and snippets.

View sthewissen's full-sized avatar
🤷‍♂️
Developing tings.

Steven Thewissen sthewissen

🤷‍♂️
Developing tings.
View GitHub Profile
@sthewissen
sthewissen / Animate.cs
Created February 7, 2019 13:20
Animation view code
public bool _isLiked;
public void Handle_OnClick(object sender, EventArgs e)
{
var animation = ((AnimationView)sender);
if (_isLiked)
{
_isLiked = false;
animation.PlayFrameSegment(0, 1);
@sthewissen
sthewissen / VerboseLog.txt
Created January 8, 2020 20:12
Enable verbose logging Firebase Analytics
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
public async Task Process()
{
// Get our current trades.
var activeTrades = GetCurrentTrades();
foreach (var trade in activeTrades)
{
// Check the exchange to see if we have a buy/sell order open for this trade.
var orders = GetOpenOrders(trade.Market);
public static List<double?> Sma(this List<double> source, int period = 30)
{
int outBegIdx, outNbElement;
double[] smaValues = new double[source.Count];
List<double?> outValues = new List<double?>();
var sma = TA.Library.Core.Sma(0, source.Count - 1, source.ToArray(), period, out outBegIdx, out outNbElement, smaValues);
if (sma == TA.Library.Core.RetCode.Success)
{
public class SmaCrossover : ITradingStrategy
{
public string Name => "SMA Crossover";
public List<Candle> Candles { get; set; }
public SmaCrossover()
{
this.Candles = new List<Candle>();
}
private SellType ShouldSell(Trade trade, double currentRateBid, DateTime utcNow)
{
var currentProfit = (currentRateBid - trade.OpenRate) / trade.OpenRate;
if (currentProfit < Constants.StopLossPercentage)
return SellType.StopLoss;
// Check if time matches and current rate is above threshold
foreach (var item in Constants.ReturnOnInvestment)
{
var builder = MauiApp.CreateBuilder(); builder.UseMauiApp<App>()
#if __ANDROID__
.ConfigureMauiHandlers(handlers =>
{
handlers.AddCompatibilityRenderer(typeof(Microsoft.Maui.Controls.BoxView), typeof(MyBoxRenderer));
#endif
});
return builder;
#if __ANDROID__
Microsoft.Maui.Handlers.ButtonHandler.ButtonMapper["MyCustomization"] = (handler, view) =>
{
handler.NativeView.SetBackgroundColor(Android.Graphics.Color.Green);
};
#endif
}
}
using Microsoft.Maui;
using Microsoft.Maui.Hosting;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
using Microsoft.Maui;
using Microsoft.Maui.Controls;
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new MainPage();
}