Skip to content

Instantly share code, notes, and snippets.

View samuelcaldas's full-sized avatar
💭
I may be slow to respond.

Samuel Caldas samuelcaldas

💭
I may be slow to respond.
View GitHub Profile
@samuelcaldas
samuelcaldas / AddonTest.cs
Created July 4, 2023 08:31
An exemple for testing ninjatrader addons
using NinjaTrader.Cbi;
using NinjaTrader.UnitTest;
using System;
using System.Linq;
namespace NinjaTrader.NinjaScript.AddOns
{
public class AddonTests : TestCase
{
private const string InstrumentName = "MES 09-23";
@samuelcaldas
samuelcaldas / GymSharp.cs
Last active May 7, 2023 08:06
This class represents a gym environment that can be interacted with in C# using Python.NET. It uses the Python.Runtime library to create an instance of a gym environment and exposes methods to perform actions, get observations, reset the environment, render it, and close it. The ObservationDimensions and NumActions properties return the dimensio…
using Python.Runtime;
using System;
using System.Collections.Generic;
namespace GymSharp
{
public class Env : IDisposable
{
private dynamic env;
private PyObject pyEnv;
@samuelcaldas
samuelcaldas / perceptruino.ino
Last active April 9, 2023 03:37
Este código é um exemplo de como implementar um Perceptron simples usando um Arduino e um LED endereçável.
/*
PerceptrUINO - Perceptron com Arduino
Samuel Oliveira Caldas
Como utilizar o PerceptrUINO:
- Conecte o Arduino a uma fonte de energia
- O LED piscará azul, verde e vermelho 3 vezes e ficará branco indicando está pronto para ser utilizado
- Para treinar a rede, pressione e segure um dos três botões de entrada enquanto o LED estiver piscando
- Pressione o botão "Certo" ou "Errado" para indicar se a cor do LED é a cor esperada para aquele botão
- Faça isso algumas vezes para que a rede aprenda
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
#region Using Statements
using NinjaTrader.Gui;
using NinjaTrader.Gui.Tools;
using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Xml.Linq;
#endregion
#region Using declarations
using System;
using System.Windows;
using System.Windows.Controls;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Tools;
using NinjaTrader.NinjaScript;
#endregion
namespace NinjaTrader.NinjaScript.AddOns
@samuelcaldas
samuelcaldas / ppo_cartpole.py
Created November 6, 2021 03:18
Implementation of a Proximal Policy Optimization agent for the CartPole-v0 environment.
"""
Title: Proximal Policy Optimization
Author: [Ilias Chrysovergis](https://twitter.com/iliachry)
Date created: 2021/06/24
Last modified: 2021/06/24
Description: Implementation of a Proximal Policy Optimization agent for the CartPole-v0 environment.
"""
"""
## Introduction
@samuelcaldas
samuelcaldas / KerasA2C.cs
Created March 18, 2021 04:31 — forked from alexhiggins732/KerasA2C.cs
Keras Actor Critic in TensorFlow.net
using System;
using System.Collections.Generic;
using NumSharp;
using Tensorflow.Keras.Layers;
using Tensorflow.Keras.Losses;
using Tensorflow.Keras.Optimizers;
using Tensorflow.Keras.Utils;
using static Tensorflow.Binding;
using static Tensorflow.KerasApi;