The Closing (Camp)Bell
Made by Ian Lee, Himanshu Rasam and Jon Sharrah
Made by Ian Lee, Himanshu Rasam and Jon Sharrah
Ambient device for tracking changes in stock price and analyst positions of individual company.
Created: February 4th, 2016
Problem:
Millions of Americans own stock but the vast majority do not hold large positions or follow market movements daily or even weekly, causing them to miss out on key market changes that cost them money. In fact, the average investor makes fewer than 20 total trades a year and holds just 5 stocks.
We sought to develop a device that would notify these amateur investments of critical market changes that could signal a need to reevaluate their current position without needing to log into their trading platform.
Ideation:
From the beginning we agreed as a team that we sought to build an ambient device that leveraged servo and light in combination to present complex information.
From here, the group brainstormed a variety of monetary related ideas and presented visions for how those differing ideas could be manifested. These ranged from alcohol spend tracking to budget monitoring to foreign exchange conversion to ultimately stock tracking.
Once we narrowed in on a problem area we sought to address, the team conducted brief but effective user research into what data indicators were key to our target market (this involved a combination of personal experience and advice outreach to friends and family) and what data indicators were readily available online and could be combined with IFTTT to build a working prototype. Through this process we zeroed in on real-time changes in stock price, which shows short term directional changes in the stock that could be of interest to someone closely tracking their position, and average analyst ratings which reflect consensus views of the stock's long term prospects. While price fluctuations happen on a daily and minute-by-minute basis, changes in analyst ratings are far less frequent and worthy of attention when they occur.
After IDing these two variables, we began ideating on form factors to present this information and quickly narrowed in on a non-digital symbolic indictor to represent a particular stock (Bird = Twitter, Apple = Apple, Soup Can = Campbell's) with light indication for price. This seemed less intrusive to display in a conspicuous position like a bookshelf or desk and similar in our minds nature to a paperweight. A Campbell's Soup Can was chosen because of availability and is a subtle reference to CMU alumnus Andy Warhol's famous pop art.
Process:
The development process was a team initiative with each member of the team taking ownership of a different element of development (circuit/casing, LED code, servo code) and then coming back together for assembly. Like any project, assembly was fraught with issues and required a united team effort to finally get the code, body, and circuit to cooperate and function as a single unit.
Code functionality:
The basic aim was to get 2 output mechanisms to display:
a. Current stock value
b. Analyst suggestion to BUY/HOLD/SELL
We used the real time stock values as our input and LED bulbs as an ambient display output for that data. For analyst suggestions, we created a dummy data sheet in google docs (https://docs.google.com/spreadsheets/d/1u62uZfciWOI1yK4Vo23IaalkCooMIA3k0uLpN7Se0qU/edit?usp=sharing) and connected it to an RSS feed to input the analyst suggestions. We decided to use the Campbell soup can as our indicator for BUY/HOLD/SELL.
The display therefore has 2 ambient displays integrated on one platform which give real-time stock updates and also suggestions about what one should be doing with their stocks.
IFTTT integrations:
We used total of 3 IFTTT recipes for this code. One was to extract data from the RSS feed (which was update by the google spreadsheet) and send it to call a function on the particle.
The other 2 recipes call a function in the code when the price goes above or below the opening stock price.
// CODE ITERATION 1: Using RGB
// Himanshu Rasam, Jon Sharrah, Ian Lee
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
int stock_analysis=0;
/*
int redPin = D2; // RED pin of the LED to PWM pin **A0**
int greenPin = D0; // GREEN pin of the LED to PWM pin **D0**
int bluePin = D1; // BLUE pin of the LED to PWM pin **D1**
int redValue = 255; // Full brightness for an Cathode RGB LED is 0, and off 255
int greenValue = 255; // Full brightness for an Cathode RGB LED is 0, and off 255
int blueValue = 255; // Full brightness for an Cathode RGB LED is 0, and off 255*/
void setup()
{
myservo.attach(D3); // attaches the servo on pin 0 to the servo object
Particle.function ("newData", newData);
Particle.variable ("stock_analysis", &stock_analysis, INT);
indicator();
// Set up our pins for output
pinMode( redPin, OUTPUT);
pinMode( greenPin, OUTPUT);
pinMode( bluePin, OUTPUT);
//Register our Particle Core function here
Particle.function("led", ledControl);
// turn them all off...
analogWrite( redPin, redValue);
analogWrite( greenPin, greenValue);
analogWrite( bluePin, blueValue);
}
void loop()
{}
/*{
if (stock_analysis<=3)
{ pos= (int)(stock_analysis/3*60);
myservo.write (pos);
}
else if (stock_analysis>3 && stock_analysis<=6 )
{ pos= (int)(stock_analysis/3*60);
myservo.write (pos);
}
else if (stock_analysis>6 && stock_analysis<=9 )
{ pos= (int)(stock_analysis/3*60);
myservo.write (pos);
}
}*/
/*int newData( String s_a)
{
Serial.print( "Received = ");
Serial.println( s_a );
// if the first row is an decimal number and we wanted to extract
// it from the string.. we would do this.
// find the index of the first comma in the string
int spacePos = s_a.indexOf(",");
// create a substring from the first character to the first comma
// and convert that to a floating point (decimal number).
float spend = s_a.substring(0, spacePos ).toFloat();
stock_analysis = spend;
// Return 1 to say completed successfull
return 1;
}*/
void indicator()
{
if (stock_analysis<=3)
{ pos= (int)(stock_analysis/3*60);
myservo.write (pos);
}
else if (stock_analysis>3 && stock_analysis<=6 )
{ pos= (int)(stock_analysis/3*60);
myservo.write (pos);
}
else if (stock_analysis>6 && stock_analysis<=9 )
{ pos= (int)(stock_analysis/3*60);
myservo.write (pos);
}
delay (3000);
}
}
/*int ledControl(String command)
{
String colors[3];
colors[0]="";
colors[1]="";
colors[2]="";
int index = 0;
for( int i = 0; i < command.length(); i++ )
{
if( index < 3 ){
char c = command.charAt(i);
colors[index] += c;
if( c == ',') index++;
}
}
// get the red component...
redValue = colors[0].toInt();
// now green
greenValue = colors[1].toInt();
// now blue
blueValue = colors[2].toInt();
// write the mixed color
analogWrite( redPin, redValue);
analogWrite( greenPin, greenValue);
analogWrite( bluePin, blueValue);
return 1;
}*/
Click to Expand
// FINAL CODE
// The Closing (Camp)Bell Ambient Stock Tracker
// Himanshu Rasam, Jon Sharrah, Ian Lee
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
int stock_analysis= 0;
int ledGreen = D0;
int ledRed = D1;
void setup()
{
myservo.attach(D3); // attaches the servo on pin 0 to the servo object
Particle.function ("newData", newData);
// Set up our pins for output
Particle.function("ledGreen", ledControlG);
Particle.function("ledRed", ledControlR);
pinMode(ledGreen, OUTPUT);
pinMode(ledRed, OUTPUT);
digitalWrite(ledGreen, LOW);
digitalWrite(ledRed, LOW);
}
void loop()
{
}
int newData( String s_a)
{
Serial.print( "Received = ");
Serial.println( s_a );
// if the first row is an decimal number and we wanted to extract
// it from the string.. we would do this.
// find the index of the first comma in the string
int spacePos = s_a.indexOf(",");
// create a substring from the first character to the first comma
// and convert that to a floating point (decimal number).
float spend = s_a.substring(0, spacePos ).toFloat();
stock_analysis = spend;
// Return 1 to say completed successfull
return 1;
}
void indicator()
{
if (stock_analysis<=3)
{ pos= (int)(130+stock_analysis/3*14);
myservo.write (pos);
}
else if (stock_analysis>3 && stock_analysis<=6 )
{ pos= (int)(130+stock_analysis/3*14);
myservo.write (pos);
}
else if (stock_analysis>6 && stock_analysis<=9 )
{ pos= (int)(130+stock_analysis/3*14);
myservo.write (pos);
}
}
int ledControlG(String command)
{
int state = LOW;
if(command == "HIGH") state = HIGH;
else if(command == "LOW") state = LOW;
else return -1;
digitalWrite(ledGreen, state);
digitalWrite(ledRed, LOW);
return 1;
}
int ledControlR(String command)
{
int state = LOW;
if(command == "HIGH") state = HIGH;
else if(command == "LOW") state = LOW;
else return -1;
digitalWrite(ledRed, state);
digitalWrite(ledGreen, LOW);
return 1;
}
Click to Expand
Final Outcome:
Our final outcome is an IOT connected device that pulls real-time stock price changes and analyst ratings from the cloud and presents them in a physical and dynamic fashion to the end-user. B/c of lag and update delays with IFTTT, we ended up using simulated data for our video below and presented a price change schedule similar to Campbell's real price fluctuations the day before and simulated but correlated analyst shifts. For a bit of fun, we threw in a CNBC style news voiceover.
Reflection:
While we ultimately were able to build a functional IOT device that meets our functional requirements, in reflection there are several improvements to both the physical casing and code that could further improve the user experience.
#1. More granular information on price changes: the current prototype shows a binary state on price change (up or down), the 5 LED indicators could be better leveraged to show the degree of change to help signify and alert the end-user to large changes in price.
#2. Smoother Servo Movements: the current prototype adjusts to changes in analyst positions, but the movements of the device are jerky. Improvements in the code could provide for more subtle and delicate servo movements.
#3: Multiple Stock Tracking: While this would require a rethinking of the physical embodiment. It is well understood by the group that most traders hold multiple positions in various stocks and thus would require several such devices to track an entire portfolio. While some users may like this, future prototypes could explore ways of demonstrating data from multiple stocks concurrently as well as displaying additional variables such as News Alerts, SEC filings, and stock price figures that may be of high relevance to some users.
#4: Smaller Casing: The original idea sought to create an ambient paperweight type device that would blend into an office or desk environment while presenting key stock information. While the prototype meets these requirements in a general sense, future prototypes could explore more elegant casings and form factors to convert this engineering prototype into an artistic piece worthy of prime placement on a trader's desk.
This course charts the emergence of the now "connected world" to explore the possibilities for future products and connected spaces.
Ambient device for tracking changes in stock price and analyst positions of individual company.