Click here to Skip to main content
15,881,559 members
Articles / Programming Languages / VBScript

Conversion of decimal to tick format and vice versa

Rate me:
Please Sign up or sign in to vote.
4.75/5 (3 votes)
30 Dec 2007CPOL1 min read 46.2K   922   6   4
VB script Algorithm to convert from decimal to ticks and vice versa

Introduction

Tick format is pretty common format used by traders in fixed income trading. Decimals can be very mind-numbing to look at; tick format is very convenient to track small changes in price/yield of the bond. Here is a brief example: Tick Value: 99-105 Equivalent Decimal Value: 99.332. Anatomy of Tick Value: 99=pre decimal value. 10=Tick value and is 1/32nd of decimal. 5=1/8th of of 32nd. We can convert to decimal as follows: Decimal Value (99.332) = 99 + ((10 + (5/8)) / 32)

Background

I tried googling algorithm for doing it but could not find anything useful and decided to write one of my own. I have written this in VB script. This could be easily converted to C#/VB.Net or any other programming language.

Using the code

“+” and “-“ buttons in attached excel file typically increments / decrements the number in cell ‘b5’ by 1/8th of a tick. For example: Number in cell b5: 99-106. Clicking “+” button: 99-107. Clicking “-” button: 99-105. Cell “b10” presents the decimal equivalent of the tick value presented in cell “b5”. Special Notation: If the number in 1/8th of a tick in ‘4’ then it is represented as “+”. That is, 99-104 will be presented as 99-10+

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Southmountain15-May-13 11:35
Southmountain15-May-13 11:35 
QuestionThanks! Pin
Lupuj17-Dec-12 23:27
Lupuj17-Dec-12 23:27 
Questionthanks.. Pin
Jozo Leko12-Nov-12 22:43
Jozo Leko12-Nov-12 22:43 
QuestionThanks for Sharing this Pin
Rak_i12-May-12 14:05
Rak_i12-May-12 14:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.