I am trying to stream data by using an Alpaca paper trading account on a Windows 10 terminal, but instead of streaming data it returns empty. Does anybody know what I am doing wrong?
note: I have installed wscat by typing npm install -g wscat and i have also downloaded node.js
First I type:
wscat -c wss://paper-api.alpaca.markets/stream
The terminal respondes with:
Connected (press CTRL+C to quit)
I then follow up with:
{"action": "authenticate","data": {"key_id": "my_key_id", "secret_key": "my_secret_key"}}
The terminal responds with:
{"stream":"authorization","data":{"action":"authenticate","status":"authorized"}}
Finally I type:
{"action": "listen", "data": {"streams": ["T.SPY"]}}
The terminal responds with:
{"stream":"listening","data":{"streams":[]}}
I want it to reply with streaming data.
The reason it didn't work for me was because I was using a paper trading account instead of a live trading account. If you want to stream on a paper trading account follow these steps:
Firstly download node.js on the internet.
After you have downloaded node.js open up your terminal and type:
npm install -g wscat
When wscat has been installed type:
wscat -c wss://stream.data.alpaca.markets/v2/iex
The terminal will respond with:
[{"T":"success","msg":"connected"}]
Then you type:
{"action": "auth", "key": "your_key", "secret": "your_secret_key"}
The terminal will respond with:
[{"T":"success","msg":"authenticated"}]
Lastly you type:
{"action":"subscribe","quotes":["SPY"]}
Now you should be getting streamed data from a paper trading account on your terminal.
Related
I was playing my game normally before the update, I was at Debian 9.3 Stretch.
After update I try to run the game with the same command.
bash start-tibia.sh
And Output this:
No protocol specified
QXcbConnection: Could not connect to display :0
Aborted
I don't know why this happening.
My system: enter image description here
Important if I run the application with a normal user it works, but with the root user isn't work.
Any helps would be appreciated. :B
-Melt
I'm trying out this Redis. I Was following some YouTube tutorials, but I cannot input commands on here. I need the C:\Redis> to type in commands but all I have is a flashing underscore:
EDIT: Hi, it is just a ctrl + c which closes the server but I was going to attach windows.conf to it so a new server connection is cool.
You need redis client(redis-cli). This is redis-server. If you have already downloaded then run redis-cli otherwise download and install redis-cli.
I have created multiple bots using Xcode and Xcode server. I'd like to backup these bots and transfer it to another machine. How can this be done?
All of the Xcode Server bot information is stored in a CouchDB. The path (Current as of Server.app 5.2, and Xcode.app 8.2.1) is:
/Library/Developer/XcodeServer/Database/*
/Library/Developer/XcodeServer/Database/xcs.couch
You can probably copy & paste the entire 'XcodeServer' folder from one server to another and startup the Xcode Server Service.
A couple other helpful hints when dealing with Xcode Server:
The CouchDB instance for Xcode Server can be accessed at: http://localhost:10355/_utils/
Check out this great series of articles on the nuts and bolts of Xcode Server: https://honzadvorsky.com/articles/2015-05-04-under-the-hood-of-xcode-server/
Maybe this little guide can help.
From the machine in which there are the bots you want migrate, open the browser and go to:
https://localhost:20343/api/bots
Save the JSON you just received in a text file and import it to the destination machine.
From the destination machine, open a terminal and:
cd /Library/Developer/XcodeServer/CurrentXcodeSymlink/Contents/Developer/usr/share/xcs/xcsd/routes
sudo nano routes_bot.js
Edit the file adding the following lines before the line "module.exports = router":
router.route('/bots/noauth').post(prepareRequest, bot.create);
Save the file you just edited;
Restart XcodeServer:
sudo xcscontrol --shutdown
sudo xcscontrol --start
Wait until the restart process is finished;
Open POSTMAN (or any http client you want), open Settings and disable "SSL certificate verification";
Prepare a request with the following parameters:
POST
URL: https://localhost:20343/api/bots/noauth
Headers:
Content-Type: application/json
Body: "raw"
One at time, paste into the BODY the items of the "results" array contained into the JSON you saved at the point 2, and send the request.
Now you have all your bots. Enjoy!
I want to build a full version of Ubuntu 14 desktop as the base image for gui applications, I know how to build on the Ubuntu desktop version by the debootstrap, as described in https://docs.docker.com/articles/baseimages/, but that is a minimal Linux version and some GUI application cannot run perfectly, because there are some basic components missing, such as a font family, so I want the full control of a basic image, thanks!
fcwu/docker-ubuntu-vnc-desktop
https://github.com/fcwu/docker-ubuntu-vnc-desktop provides a convenient setup:
docker run --name ubvnc -p 6080:80 -p 5900:5900 dorowu/ubuntu-desktop-lxde-vnc:bionic
Then either:
visit: http://127.0.0.1:6080/#/ which runs a noVNC more limited JavaScript VNC client
run:
sudo apt-get install tigervnc-viewer
xtigervncviewer :5900
Then inside vinagre, you might want to go into full screen mode to be able to see the full desktop
I also tried vinagre, but it was much laggier when scrolling Firefox on YouTube.
To quit just kill docker on the terminal. And to restart the machine
docker start ubvnc
and then reconnect with VNC. Then to quit the machine:
docker stop ubvnc
You have to wait a few seconds for the VNC server on the guest to start before you can connect.
Chromium won't start from the menu. If you try to launch it from the command line it explains why:
Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
Firefox does not care however.
TODO: no audio. --device /dev/snd did not help:
How to play sound in a docker container
https://forums.docker.com/t/how-to-get-sound/36527
https://github.com/fcwu/docker-ubuntu-vnc-desktop/issues/49
See also:
Can you run GUI applications in a Docker container?
How to open Ubuntu GUI inside a Docker image
Tested on Ubuntu 19.04 host, fcwu/docker-ubuntu-vnc-desktop, dorowu/ubuntu-desktop-lxde-vnc image id: 70516b87e92d.
I don't see the benefits of it, but impossible n'est pas français (impossible isn't French).
Docker Desktop is a way that will give you an X11 server to connect on using SSH.
This Dockerfile creates a docker image and once it's executed it creates a container that runs X11 and SSH services. The ssh is used to forward X11 and provide you encrypted data communication between the docker container and your local machine.
I created a simple http server in Node.js.
I wanted to make it run permanently on my Windows 2008 machine, so that, if the computer reboots, it automatically restarts.
So I made it a service with this command:
C:\Users\Administrator>sc create translate binPath= "node D:\Apps\translate\machine-learning-server\servertranslate.js" DisplayName= "Translation Server"
Then started it with:
C:\Users\Administrator>sc start translate
and got the following error message:
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.
The program works OK when I start it from the command line (not as a service).
What is the easiest way to have a node.js web server that restarts automatically when the computer reboots?
In the past, I've used NSSM for running Node.js applications as services on Windows. It works quite well, and can be configured to automatically restart your application in the event of a crash.
http://nssm.cc/usage
nssm install YourService "C:\Program Files\Node.js\node.exe" "C:\something\something.js"
As I recall, the Service runtime environment isn't the same as running something under the command shell. In particular, Services are required to respond to messages from the system to indicate their running status, as you've seen :-)
This must be a solved problem, though...
Sure enough:
https://npmjs.org/package/windows-service
windows-service
Run Node.JS programs as native Windows Services.
npm install windows-service
Use this one, really simple
https://github.com/coreybutler/node-windows
Create two js file on your project. And run those as
node your_service.js
node your_service_remove.js
For install:
/**
* Created by sabbir on 08/18/2015.
*/
//ref: https://github.com/coreybutler/node-windows
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'nodeDemoApp',
description: 'The nodejs.org example web server.',
script: 'D:\\NodeJS\\demoWeb\\bin\\www'
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
For uninstall:
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'nodeDemoApp',
script: require('path').join(__dirname,'bin\\www')
});
// Listen for the "uninstall" event so we know when it's done.
svc.on('uninstall',function(){
console.log('Uninstall complete.');
console.log('The service exists: ',svc.exists);
});
// Uninstall the service.
svc.uninstall();
At a guess, I'd say that the service doesn't know where to find the node binary. You've probably updated your profile's PATH variable. My recommendation is to ALWAYS hard code the full path in service scripts.
As mentioned in others questions about it, I'd like to share here (because it wasn't referred yet) a node.js module called WinSer that wraps NSSM and its usage is very simple, maybe it helps someone someday.
: )
You could try the package qckwinsvc. First install it globally:
npm install -g qckwinsvc
And then from the cmd:
qckwinsvc
prompt: Service name: [...]
prompt: Service description: [...]
prompt: Node script path: [/path/to/.js file]
To uninstall:
qckwinsvc --uninstall
Always a good idea to look at the number of downloads something is getting.
PM2 seems to be winning and is very easy.
https://medium.com/#harshamw/deploying-a-node-js-application-in-iis-using-a-reverse-proxy-process-management-using-pm2-3d59b83d7f76
You'll need to then use https://www.npmjs.com/package/pm2-windows-service to start it as a windows service on reboot.