Home

Google's Undocumented Finance API

Written by: NetworkError, on 18-05-2013 16:25
Last update: 18-05-2013 16:25
Published in: Public, Technical Wootness
Views: 6916


I've been playing around with the undocumented Google Finance API. It provides intra-day data for the past 10 days and day-granularity data going back for years. Handy!

There are lots of web pages that attempt to describe how this thing works. I've pulled together a bunch of data from them, as well as a few of my own observations. You can watch this thing in action by popping open FireBug while messing about on with the google finance chart. It will make AJAX requests to this API.

Here's an example URL to pull all historical data for GOOG at daily granularity:
http://www.google.com/finance/getprices?q=GOOG&x=NASD&i=86400&p=40Y&f=d,c,v,k,o,h,l&df=cpct&auto=0&ei=Ef6XUYDfCqSTiAKEMg

What do all the parameters mean? Here's a partial list:

q - Stock symbol
x - Stock exchange symbol on which stock is traded (ex: NASD)
i - Interval size in seconds (86400 = 1 day intervals)
p - Period. (A number followed by a "d" or "Y", eg. Days or years. Ex: 40Y = 40 years.)
f - What data do you want? d (date - timestamp/interval, c - close, v - volume, etc...) Note: Column order may not match what you specify here
df - ??
auto - ??
ei - ??
ts - Starting timestamp (Unix format). If blank, it uses today.
http://www.google.com/finance/getprices?q=GOOG&x=NASD&i=86400&p=40Y&f=d,c,v,k,o,h,l&df=cpct&auto=0&ei=Ef6XUYDfCqSTiAKEMg

The output includes a header that describes the columns, timezone offset, and a few other interesting bits of information. The data rows are basically CSV format.

One tricky bit with the first column (the date column) is the full and partial timestamps. The full timestamps are denoted by the leading 'a'. Like this: a1092945600 The number after the 'a' is a Unix timestamp. (Google it if you're not sure what it is.) The numbers without a leading 'a' are "intervals". So, for example, the second row in the data set below has an interval of 1. You can multiply this number by our interval size (a day, in this example) and add it to the last Unix Timestamp. That gives you the date for the current row. (So our second row is 1 day after the first row. Easy.)

Sample output format:

EXCHANGE%3DNASDAQ
MARKET_OPEN_MINUTE=570
MARKET_CLOSE_MINUTE=960
INTERVAL=86400
COLUMNS=DATE,CLOSE,HIGH,LOW,OPEN,VOLUME,CDAYS
DATA=
TIMEZONE_OFFSET=-240
a1092945600,100.335,104.06,95.96,100.01,22353092,1 <-- a##### denotes a unix time stamp.

1,108.31,109.08,100.5,101.48,11429498,1 <-- The first column (1) * interval (1 day) + last full unix time stamp = date
4,109.4,113.48,109.05,110.76,9140244,1
5,104.87,111.6,103.57,111.24,7632224,1
6,106,108,103.88,104.96,4599110,1
7,107.91,107.95,104.66,104.95,3551168,1
8,106.15,108.62,105.69,108.1,3108977,1
11,102.01,105.49,102.01,105.49,2601620,1 <-- Note:  We jumped from 8 to 11.  We skipped 2 days.  This was a weekend.
12,102.37,103.71,102.16,102.32,2463427,1

Hopefully this gives you what you need to build your own stock data-feed. Happy hacking!

Read more... Be first to comment this article   |   Print   |   Send to friend
 

Some lessons for agile software development

Written by: NetworkError, on 08-01-2013 17:51
Last update: 11-01-2013 10:04
Published in: Public, Technical Wootness
Views: 2288


I've been working as a Tech Lead with one foot in the Product Management world for a while now. I've had successes and failures. Here are some lessons I've learned. (I could write a whole essay on this, but I think it would just cause word inflation and dilute the point.) I'm primarily keeping this as a reference for myself and will update it with new lessons learned. Hopefully others will find some useful gems here.

Some principals of good software development:

  • Plan using these tools:
    • A concise list of specific requirements <-- Should focus on what goals you want to accomplish and why.
    • Stories to fulfill each requirement <-- Should focus on how you want to accomplish each goal; talk exclusively about behaviors. (Build a walking skeleton out of real 3x5 cards or stickies - the sense of touch and spacial awareness are powerful memory tools.)
    • Talk about implementation details and get on the same page, but don't get too hung up on it yet
    • A high-level architecture diagram <-- Very helpful any time you need to explain your project to someone else
    • Also: Gut-check your skeleton regularly
  • Don't over-plan or get hung up on details. Instead, iterate and refactor. Once you get started:
    • Assign stories piece-by-piece, sprint by sprint
    • Leave the specific implementation specs up to the developers. Document and stay synced as you go. (Document all public inputs and outputs rigorously.)
  • Stick to the essentials. Leave nice-to-haves completely off the table; they'll only distract you. This should be a litmus test for every feature, story, task, and change request:
    • "It's not the daily increase but daily decrease. Hack away at the unessential." --Bruce Lee
  • No new functionality should be checked in without an accompanying test (unit, module, integration...)
    • Tests should be written first. (Start red.) Code should be written to satisfy them. (Go green.) Iterate and refactor. (Loop: Red -> Green -> Refactor)
  • All modules within a given silo should live behind a service layer. Keep your silos small-ish. No back-doors or direct access to files/dbs. Period. (Case study: Amazon.)
  • QA should be able to construct their tests based off your stories and the docs written by developers as they implement.
    • Development should automated testing for all behaviors and units. QA should primarily focus on exploratory testing, and reviewing the test automation.

Read more... User comments (1)   |   Print   |   Send to friend
   

L4D (Left 4 Dead) Multiplayer LAN with Single Account

Written by: NetworkError, on 15-04-2011 20:52
Last update: 15-04-2011 21:20
Published in: Public, Things that go Boom
Views: 28238


I love playing Left 4 Dead. I love throwing Left 4 Dead LAN parties from time to time. However, I only have 1 steam account, and many of my friends do not have a copy. What's a geek to do? How shall I go about spreading the Left 4 Dead addiction?

Do you remember the good old days of StarCraft and Warcraft; back when you could install a spawn and play a LAN party on one game disc? Well you can do something similar with Left 4 Dead.

Before I dive into the technical details, let's spend a few sentences on ethics. Is playing a LAN party on one account against the EULA? Probably. Is it stealing? No. Is it a great way to turn friends into paying Steam customers? Absolutely. I have gotten a number of friends to purchase a copy after playing a few LAN parties with me. Now that that's out of the way...

What you will need:

  • 2+ PCs
  • A LAN (or VPN)
  • A steam account with a valid license for Left 4 Dead

To pull this off, you need to get all your Steam clients/L4D installs on the exact same version. You have to update one computer at a time since you can't be logged into Steam more than once with a single account. Do this on each PC.

  1. Install Steam, if necessary.
  2. Log in and install the game, if necessary.
  3. Launch the game once to ensure it is up-to-date.
  4. Restart Steam once to ensure all client updates are applied.
  5. Put Steam in offline mode.
  6. Launch Left 4 Dead. Go to Options -> Keyboard/Mouse. Enable the developer console.

Next, you need to run some console commands. First, bring up the server:

  1. Press the ~ key. (It's to the left of the number one.) This will open the developer console.
  2. Type "sv_lan 1" [ENTER] (This turns LAN mode on.) Note: Leave the double quotes off.
  3. Type "sv_allow_lobby_connect_only 0" [ENTER] (This allows a game without a lobby.)
  4. Type "net_start" [ENTER]
  5. Type "map ". Press the down arrow until you find the map you want. Then press [ENTER]. This will start the game.
  6. If you want to allow users to use cheats or change characters, type "sv_cheats 1" [ENTER]

Clients need to run a few commands before they connect:

  1. Press the ~ key.
  2. Type "sv_lan 1" [ENTER]
  3. Type "sv_allow_lobby_connect_only 0" [ENTER]
  4. Once the server is up, you should see an icon appear at the bottom of the screen. Hit ~ to get out of the Developer Console, then click the icon and join the game. (The icon will only appear if broadcast is working. If it's not, use the console command "connect [IP ADDRESS OF SERVER]" [ENTER].)

Here are some other useful commands. Most of these are only usable by the server:

  • sb_takecontrol [Namvet, Biker, TeenGirl, Manager] (Ex: "sb_takecontrol Namvet" [ENTER] changes you to the Bill character, assuming no one else is using him. sv_cheats must be set to 1 for this to work.)
  • maxplayers [1-8] (change number of players the server will accept. Default is 4, I think.)
  • director_no_human_zombies 0 (turn on versus)
  • director_force_versus_start 1 (Start versus mode.)
  • Note: Press 'm' during the game to change teams.
  • z_difficulty [easy, normal, hard, impossible]
  • z_comon_limit [0+] (how many common zombies do you want in a regular horde event?)
  • z_mob_spawn_min_size [0+], z_mob_spawn_max_size [0+] (How big do you want your mobs to be?)
  • z_background_limit [0+] (How many common zombies do you want wandering around?)
  • sb_all_bot_team 1 (Play versus by yourself.)
  • spectate (Useful if you're trying to shuffle who is using what character.)
  • jointeam [1-4] (2 = Survivor, 3 = Infected.)

This is hardly a comprehensive list of console commands, but that's not what I was going for. This is the list of commands I scrounged up from various sources to easily run a LAN game. (I couldn't find a single source that put them together in an easy set of instructions like this. That's why I'm writing this guide.) If you want to find more console commands (there are a ton of them), I suggest googling for them.

Happy Zombie hunting!

Read more... Be first to comment this article   |   Print   |   Send to friend
   

Updated UTF-8 Character Map

Written by: NetworkError, on 11-04-2009 22:42
Last update: 01-05-2009 08:43
Published in: Public, Technical Wootness
Views: 5198


I updated my UTF-8 character map. It's actually getting some traffic so I thought I would make it slightly more feature-rich. I fixed a few quirks and added the ability to search for a character.

Original UTF-8 character map article (with source code)
UTF-8 (Unicode) character map in action

Read more... Be first to comment this article   |   Print   |   Send to friend
   

Years of Service Clock

Written by: NetworkError, on 07-04-2009 10:25
Last update: 07-04-2009 13:34
Published in: Public, Technical Wootness
Views: 4396


How long have you been slaving away at your job? Married? Living a lie? Whatever it is, finding out how long it's been going on is interesting and watching the seconds tick away is even more interesting.

Or do you want a count-down timer to a special date?

In any case, I have the solution. Without further adieu, I give you the "Years of Service" or "Count Up/Down" clock (JavaScript Edition). To use, fill out the simple form below and bonk on the button.

Years of Service Clock:


0 years (decimal)
0 years
0 / 52 weeks
0 / 7 days
0 / 24 hours
0 / 60 minutes
0 / 60 seconds
Start date (ex: Aug 9, 1995 9:15 am)
Num. Decimal Points on Decimal Year


PHP Command Line Version

If you want to run this in a terminal somewhere, try the PHP version...

Read more... Be first to comment this article   |   Print   |   Send to friend
   

Crazy Talk String Funkification Using UTF-8

Written by: NetworkError, on 03-04-2009 12:55
Last update: 01-05-2009 08:45
Published in: Public, Technical Wootness
Views: 4696


I recently wrote a ASCII to UTF-8 randomizing program called Crazy Talk that would take a standard ASCII string and randomly funkify it using UTF-8 characters.

Example: Tɥis is a ŧypical střing thåŧ has ʙeeʼn Ƭunʞified uƨing Crazȳ Ʈalƙ.

I wrote it for a few reasons:

  • I wanted to make my FaceBook posts a lot more annoying.
  • I wanted to play with UTF-8 character encoding a bit more.
  • I wanted to write an OpenSearch service (and this seemed like a good candidate).

Read more... Be first to comment this article   |   Print   |   Send to friend
   

UTF-8 Character Map

Written by: NetworkError, on 07-01-2009 12:00
Last update: 09-02-2012 18:49
Published in: Public, Technical Wootness
Views: 20122


Update:
I have added search functionality. You can search for any UTF-8 character (within the first 1,000,000 characters) and it will take you to the correct page and highlight the right row. I've updated the source code below.

I recently needed to write tests using some UTF-8 characters from specific ranges. I couldn't find a character map I liked out on the Intertubes, so I whipped one up myself. It's not what I would consider "well written", but it does work so I thought I would share it here.

You can see the UTF-8 character map in action here.

You can download the code here. (It's a bit ugly. It started as a pet project and grew out of control. You know how it is.)

Read more... User comments (1)   |   Print   |   Send to friend
   

Zombies and 5 Year Olds

Written by: NetworkError, on 11-12-2008 11:10
Last update: 09-04-2009 16:18
Published in: Public, Musings and Soap Boxes
Views: 4011


If you haven't seen these quizzes, you should check them out.

My Rankings:

78%

Created by OnePlusYou - Free Dating Site

     34

Created by OnePlusYou - Free Online Dating


Read more... Be first to comment this article   |   Print   |   Send to friend
   

Page 1 of 4

<< Start < Prev 1 2 3 4 Next > End >>