yard

Linking the Cashtag and Character Counting

Link the Cashtag

Linking Cashtags (eg. $GOOG) can be done easily, StockTwits has a library that provides text processing routines for cashtags within messages. The major reason for this is to unify the various auto-linking and extraction of cashtags and to keep everything up to date with the StockTwits symbology. This library provides autolinking and extraction for cashtags, it's available on Github: https://github.com/stocktwits/stocktwits-text-js

Note: Linking URLs within a messages must always link to the original source. You can not unwrap or change a link in any way when displaying the url or linking within it.

We recommend using the Twitter text-js Library for linking URLs. The library provides autolinking and extraction for URLs. You will find it on Github: https://github.com/twitter/twitter-text-js

Counting Characters

StockTwits limits message length to 140 characters. URLs are one thing that effects character counting. Any message over 140 characters will return and error response.

Character Encoding

The StockTwits API supports UTF-8 encoding and any UTF-8 character counts as a single character. Please note that angle brackets ("<" and ">") are entity-encoded to prevent Cross-Site Scripting attacks for web-embedded consumers of JSON API output. The resulting encoded entities do count towards the 140 character limit. Symbols and characters outside of the standard ASCII range may be translated to HTML entities.

URL/Links such as "http://stocktwits.com" will be automatically converted to stks.co links and will represent "20" characters in a message count. You will not need to worry about shortening a link before you create a message. Links are defined as having a protocol such as "http://" or "https://".