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.
Trading
and copy it'sID
which 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_email
andprivate_key
from downloaded JSON file. - Share your calendar with this
client_email
and 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:
calendarId
is the ID of calendar from Calendar settings.symbols
is a comma separated list of stock symbols you want to watch.gcpCredentials.clientEmail
is an email of a Service Account which got access to the calendar.gcpCredentials.privateKey
is 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