Skip to content

Latest commit

 

History

History

stock-poller

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Simple Stock Poller

This is an example for a simple stock polling application, that retrieves data from Twelve Data API, stores the latest stock price in DynamoDB and publishes the update to a SQS queue.

Overview

It show case the capabilities of Wing to fetch data from an external API and distribute this across different systems.

Sequence Diagram

To extend this example, try making the polling application track five ticket symbols, or try displaying the information using the cloud.Website class

Prerequisite

Please make sure to use a current and working setup of the wing cli

Usage

As the Scheduler component is only available with the sim and tf-aws provider, you do have to compile and then deploy the application. For more details see also Wing compatability matrix.

Wing Console

wing it

To test the application in the Wing Console, you have to set up a secret at ~/.wing/secrets.json. For more details refer to Secrets with the Simulator target.

Wing compile

wing compile --target tf-aws main.w

cd target/main.tfaws

Initialization

For your first deployment you have to initialize Terraform in the working directory:

terraform init

And you also need to create the secret in AWS Secrets Manager, refer also to documentation of cloud.secret for AWS as target.

aws secretsmanager create-secret --name twelve-data-api-key --secret-string your_api_key

Wing deploy

terraform apply