Navigate through the seas of vast economic events while doing informed trades.
This project helps to synchronize various economic events like company earnings, dividends, CPI reports, FED meetings and market holidays into Google Calendar.
Apart from Node.js and GitHub you have to enable Google Calendar API in Google Cloud, create there a *Service Account and invite it to your calendar in Google Calendar.
This can be done by following these steps:
- Create Google account.
- Create new calendar (name it e.g.
Tradingand copy it'sIDwhich can be found in calendar settings). - Create Google Cloud account.
- Create new Google Cloud project.
- In Google Cloud enable Google Calendar API.
- In Google Cloud go to APIs & Services -> Credentials and create Service Account.
- In the Service Account create a new JSON key and copy
client_emailandprivate_keyfrom downloaded JSON file. - Share your calendar with this
client_emailand give it rights to Make changes to events.
Once Node.js and GitHub has been installed you can set up the project using terminal:
cd; mkdir trading; cd trading
git clone https://github.com/junajan/trading-events-google-calendar.git
cd trading-events-google-calendar;
npm i;
touch config/local.json
Now open file config/local.json and create config file:
{
"calendarId": "{{calendarId}}",
"symbols": "AAPL,AMZN,MSFT,NVDA,AMD,PG,COST",
"gcpCredentials": {
"clientEmail": "{{serviceAccountEmailFromGCP}}",
"privateKey": "{{serviceAccountPrivateKEyFromGCP}}"
}
}Where:
calendarIdis the ID of calendar from Calendar settings.symbolsis a comma separated list of stock symbols you want to watch.gcpCredentials.clientEmailis an email of a Service Account which got access to the calendar.gcpCredentials.privateKeyis a private key copied from JSON key of this Service Account.
Once this is done, the last step is to accept the invitation sent while sharing the calendar with Service Account. To do this, just run (has to be called only once):
npm run accept-calendar-invitation
After configuring all necessary components the usage is pretty straightforward:
# to sync all events while
npm run app
# to sync only single type of evens
npm run sync-cpi-events
npm run sync-earnings-events
npm run sync-market-holiday-events
npm run sync-dividend-events
npm run sync-fed-events- Google Calendar API documentation: https://developers.google.com/calendar/api/v3/reference/events/list
- Google Cloud Service Accounts: https://cloud.google.com/iam/docs/service-account-overview