Archives

Archives / 2018 / July
  • Complete description of arguments in jForex submitOrder

    Hello everybody,

    here I want to leave fragment of code related to submitOrder:

    public void onStart(IContext context) throws JFException {

    IEngine engine = context.getEngine();

    IHistory history = context.getHistory();

    Instrument instrument = Instrument.EURUSD;

    context.setSubscribedInstruments(java.util.Collections.singleton(instrument), true);

    ITick lastTick = history.getLastTick(instrument);

    double price = lastTick.getAsk() + instrument.getPipValue() * 5;

    double sl = lastTick.getAsk() - instrument.getPipValue() * 20;

    double tp = lastTick.getAsk() + instrument.getPipValue() * 10;

    long gtt = lastTick.getTime() + TimeUnit.SECONDS. … more

  • New class in Acumatica: PXImpersonationContext

    Hello everybody,

    here I want to document new scope in Acumatica: PXImpersonationContext. 

    As often is the case try to look at presented code:

    var thr = new Thread(

                                       () =>

                                       {

                                           try

                                           {

                                               using (new PXImpersonationContext(PX.Data.Update.PXInstanceHelper.ScopeUser)).

    .

    .

    }

                                foreach (var thread in threads)

                                {

                                    lock (thisLock)

                                    {

                                        thread.Start();

          … more

  • Manage serialization in .Net Core 2.0

    Hello everybody,

    today I want to write a short notice on how to manage uppercase/lowercase options for serialization in .Net Core.

    In mine practice I often had situation, when javascript or typescript code sends me some staff in lowercase class names, but in C# I'm used to Upper case class names. 

    Another option that you sometime can need is switching between xml and json serialization. How those options can be managed in .Net Core 2.0 ?

    For both of those options ( and even more ) you can use pipeline management of Startup class of ConfigureServices method.

    For example if you need to have xml serialization output you can use following code:

    public class Startup

        {

            // This  … more

  • Some notes on Jira usage

    Hello everybody,

    today I want to make a short recording of the following video: Introduction to Jira & Agile and Project management.

    Actually I just want to have short text version of Dan Chuparkoff's  advices.

    Task is something that is bigger then 30 minutes but smaller then 3 days to complete. It is practical don't have tasks that take more then one day to do.

    You can't wait in the middle of the task. If you are waiting in the middle of the task, then take another look, maybe you have series of tasks. 

    You can be in three modes: in progress, done, not started.

    Estimating is hard, but use estimates. And use story points, not the hours. 

    There are different kinds of story points.  … more

  • Ridge regression in C# with help of Math .Net Numerics

    Hello everybody,

    today I want to share a piece of code that took me almost few months of learning in order to implement it. It is Ridge regression. Below goes code that gives you weights for Ridge regression:

    public double[] RidgeRegression(double[][] xTrain, double[] yTrain, double lambda = 0.1)

    {

        var M = Matrix<double>.Build;

        var x = M.DenseOfRowArrays(xTrain);

        

        var ones = Vector<double>.Build.Dense(x.RowCount, 1);

        x = x.InsertColumn(0, ones);

        var y = Vector<double>.Build.DenseOfArray(yTrain);

        var xt = x.Transpose();

        var lambdaIdentity = lambda * M.DenseIdentity(x.ColumnCount);

        var sumDot = xt.Multiply(x) + lambdaIdentity;

        var  … more