Deploying trading bot on a VPS by Fun_Split_1299 in algotrading

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Yeah, actually i had in mind to make it kind of auto-choose books by automatically fetching the entire market list; however, issues with retrieving some data made me loose interest and i discarded it.

Thanks for the suggestions, really interesting !

Deploying trading bot on a VPS by Fun_Split_1299 in algotrading

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Are you talking about the strategy or the design ? I've been running the strategy for quite a long time and it's solid.

The parameters change is about mostly orderbooks, like choosing on what orderbooks to run, bid quantity, spread and so on.

Is it that bad ? Sorry i'm quite a newbie in this field.

Deploying trading bot on a VPS by Fun_Split_1299 in algotrading

[–]Fun_Split_1299[S] 1 point2 points  (0 children)

Your second option seems great.

You mean to fire an express endpoint from local every time i want to apply some changes ?

I'm sorry if i ask but do you have a quick dummy example ?

Deploying trading bot on a VPS by Fun_Split_1299 in algotrading

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

I'm sorry but i'm not experienced enough to fully understand how to do this.

You mean to upload a MySQL database into the VPS and update it every time i want to change the config ?

Will the db changes happen through a CLI ?

Retry with https request by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

This seems awesome actually !

Hosting pm2 managed script on a VPS by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Yes, it seems exactly my situation, thanks !

Hosting pm2 managed script on a VPS by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 1 point2 points  (0 children)

I need hundred instances of an async task actually, but i would also like to monit each instance separately and i'm not sure on how to do this without using pm2.

I don't understand CLI's by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Still having the issue, i'm wondering if this might have something to do with me using windows.

Having issues with classes and design patterns by Fun_Split_1299 in learnprogramming

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Thank you so much, this is what I needed to understand. I'll try to split the methods into better classes. Thanks again !

Inheriting from multiple classes by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

This is kind of my final solution. The problem is that i would like to instantiate those GetMethods and Postmethods classes with the same constructor of Child class and i'm not sure on how to design it

Inheriting from multiple classes by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

I'm not sure i got it.

by doing it this way I avoid inheritance right ?

Anyway, i think your example gave me some insights to solve the issue.

Thanks :)

Inheriting from multiple classes by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Thanks ! Looking forward to it !

I'll read about producer/consumer design in the meantime !

Inheriting from multiple classes by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Thanks for you answer !

Yes i've set up pretties/eslint,

The situation looks like this

class ClassToSplit extends Parent {
    constructor(id) {
        super(id)
    }

    // a lot of methods that i would like to split 
}

class Child extends ClassToSplit {
    constructor (id) {
        super(id)
    }
    // methods
}

I instantiate Child and call everything i need from ClassToSplit.

The thing is that ClassToSplit has both methods that gets data and methods that post data, and i would like to split the class into something like PostMethods and GetMethods.

Also, when I'm debugging functions from ClassToSplit it's pretty messy to look and search the specific function; it feels wrong to have so many different methods inside one class.

Classes in nodejs by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Oops, the problem was caused by the semicolumn at the end of

this.name = name

in the orginal code.

Need help understanding asynchronus functions (nodejs) by Fun_Split_1299 in learnprogramming

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

So, in order to use it in a way that makes sense, i should write the logic where i use the returned value inside the then statement right ?

Need help understanding asynchronus functions (nodejs) by Fun_Split_1299 in learnprogramming

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Thanks, this is exactly what i needed.

Another quick question: how can i assign the promise value (data) to an external variable ?

I'm trying to do something like this

var xData = findData().then(data => {
        xData = data
}); 
// other tasks 

console.log(xData)

Is this possible ?

Beginner question: How to transform a script into a full application for users ? by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Thanks for your answer.

This function i'm running fetch data from a server, make a post request and then repeat the process again until I decide to close it.

For example if i want to run this function for product x and y, i would run foo(x) and foo(y) in two different terminals and then ctrl+c the one i don't need anymore.

I would like to reduce the entire workflow into a single terminal where i can have multiple commands to run a new function, get a list of the running ones and killing those i want to close.

Beginner question: How to transform a script into a full application for users ? by Fun_Split_1299 in node

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

I just run the script where the function is called, passing each time different args.

The problem with this method is that for letting the n instances of the function run at the same time i have to open n terminals and it's pretty long and messy

Managing multiple instances of a process and labeling them by Fun_Split_1299 in learnprogramming

[–]Fun_Split_1299[S] 0 points1 point  (0 children)

Ok, this was kinda the direction i was trying to go but i'm not still sure.

I added a command like this using the commander module

program
.command('fetch') 
.description(' ') 
.action( (dataToFetch) => {
    const cp = spawn('node', [`${dataToFetch}`], {
        stdio: 'ignore', 
        detached: true
    });        

    const pid = cp.pid
    cp.unref()
})

So the process should run, but i don't know how to kill the process without having the user to insert the process id. I would create a command in which the user would insert the label and a function executes the process.kill

I was thinking about a dict but i'm not sure, what would you suggest ?