Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VBScript

Conversion of decimal to tick format and vice versa

4.75/5 (3 votes)
30 Dec 2007CPOL1 min read 1   927  
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)