13:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.130 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 13:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.1313:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.13

.

.

Monday, August 17, 2009

Websites I Built Last Night - I Couldn't Sleep

Richard G. Castanon, M.D., FACS: This site was also redone recently using Adobe Flash, with Actionscript 3.0.

All Ear Doctors Hearing Aids: This site was built using Dreamweaver CS4 & Flash CS4. It makes use of HTML, Flash, ActionScript 3.0, and JavaScript. The menu bar is actually a flash movie that makes use of event handlers using ActionScript 3.0. Also, the "Photos" page is a Flash slideshow that is actually a Flash movie with event handlers to stop frames. It stops at each successive frame and advances only when the subject presses the forward arrow, which advances the movie one frame. ActionScript again controls this process.

Beach, Skin and Laser Cosmetics: This site was made using Microsoft Publisher. The "index" page I actually redid (8/25/2009, or something like that) using Dreamweaver and embedded a Flash Video with some ActionScript 3.0.



Quantum Support: This site is a bare-bones site made using Microsoft Publisher. It has a Yahoo! API that retrieves stock quotes using JavaScript.

Sunday, August 16, 2009

Visual Basic for Applications Macro to Delete Rows of Cells in Microsoft Excel Based on a Criterion

This code will loop through a selected area of a column and delete rows for you. The macro will loop through the selected part of any column searching for whatever you specify. When the macro finds a cell whose content meets your criterion, it will delete the cells corresponding row and then proceed onward: it will continue looping through the remaining cells of the selected column and if it finds another cell whose content matches your criterion - it will delete that cells corresponding row. It will do this until it has looped through every cell of your selection.



To use the code you have to open Microsoft Excel's Visual Basic programming interface. This is done via the "Developer's" tab in the "Ribbon" of Excel. The pic I've uploaded here shows Excel's Ribbon and the Developer's tab is selected. The Developer's tab is not present by default. If your Developer's tab isn't present, click on the "Office Button," this is the button with the Microsoft Office logo in the upper-most corner of all Office applications. Click that button, and then click on "Excel Options" in the lower-right corner of the dialog box that appears. You should be in the "Popular" pane of the Excel Options dialog box by default. I've included a picture of that dialog box in this post. You can clearly see what I'm referring to for reference. The third selectable option down is "Show Developer tab in the Ribbon." Select that, and click "OK."



Click your Developer tab. To the far right, on the Ribbon, you'll see "Visual Basic," click that. You'll then enter the Microsoft Visual Basic programming platform. Click "Insert" and choose "Module." Copy and paste the macro below into the "Module" that appeared as a result of your clicking Insert, then Module.

Close out of the Module by clicking the red in the upper-most right corner of its dialog box. Also exit the Visual Basic platform by clicking on its red x, upper-right corner.

Now you're ready to run your macro. Select the target region of the column containing the data you want to auto-remove, click on "Macros" (the button immediately to the right of the "Visual Basic" button), highlight the macro titled "Find_and_delete," then click "Run."



A dialog box will appear asking you for input. This is where you'll enter the information/data (for example, cat) you want to remove all instances of. Click "OK"

You're done.

Please remember to save your work prior to running any macros and do it under a different name. This is for safety. It's to make sure accidental data loss from running a macro doesn't become permanent data loss. You cannot just click "undo" and retrieve the data you'd have lost from running a macro: automated changes cannot be reversed in the way manual changes can.

-----------------------------------------------------------------------------


Sub Find_and_delete()
Dim rng As Range
Dim what As String
Dim strMsg As String
Dim lok4 As String
Dim count As Integer
count = 0
lok4 = Application.InputBox("What variable?")
Do
Set rng = ActiveSheet.UsedRange.Find(lok4)
If rng Is Nothing Then
Exit Do
Else: Rows(rng.Row).Delete
count = (count + 1)

End If
Loop
MsgBox "The number of deleted cells was " & count


End Sub

Monday, August 3, 2009

What is algorithmic or black-box trading?

What is algorithmic or black-box trading?

Algorithmic trading is the process of automating the buying and selling of securities. The process is completely dependent on computers and programming languages. The advent of the Internet allowed for private individuals and financial institutions to trade directly on exchanges in ways and in volumes never before seen. This in and of itself gave rise to algorithmic trading.

Currently, almost all brokerages offer investors and firms computer programs from which to transmit market orders to exchanges, and these programs are usually either web-based platforms or free-standing programs. Through these applications or programs brokerages’ customers can trade securities directly with other market participants. As stated, these platforms can be web-based applications or interfaces (like Gmail, which is a web-based email service, for example), or they can be free-standing programs that run on your computer and don’t rely on a web browser to transmit orders to exchanges (like Microsoft Office’s Outlook application). Most web-based programs use port 80 to transmit HTTP. Many programs communicate over the Internet and don’t do so using HTTP or port 80, or web-based means and methods. Either way, these programs send communications or instructions from the client computer to the host computer, the computer receiving orders for the exchange. Exchanges act as hubs. They receive orders to buy and orders to sell from all over the world and they have a clearing house that pairs orders and that keeps track of the transactions. Clearing houses also inform brokerages that are exchange members how much capital or cash they have to have on reserves, which the brokerages provide clearing houses using customer funds.

Algorithmic trading is the process having a program interface (or interact) with the brokerage’s trading platform. These programs are almost always proprietary programs. This means that the programs are owned and/or created by the entity using them. Firms almost always employ programmers full time to write and modify the code that makes up their trading program or programs and their proprietary algorithms. There is a common misconception that these programs can, once “finished,” trade unattended and without any upkeep or maintenance. That is not true. These programs must almost always be monitored so that they don’t malfunction and do something terrible, such as rapid-fire selling when they should be buying. This could obviously result in catastrophic financial losses, lawsuits and other unforeseen events. Algo traders must monitor the trading and have to frequently interact with the platform to stop trading, close positions, and change parameters and variables.

The programs that algorithmic traders create are usually coded in a fast, object-oriented programming language, such as the C languages. Programming has changed a lot over the last 20 years. Programs are no longer one long sheet of code. Modern programs/applications consist of many different scripts or pages of code and much of it is only accessed and loaded into memory when needed. Also, programming is now done mainly through programming platforms from which one builds up a dialog box that the user interacts with by inputting data. The program performs tasks on that data, and usually produces some output. A classic example of such a program in action is a calculator. You provide input, and the calculator performs tasks on the input and returns some output once you press the ‘equals’ button.

Trading programs perform the same way, with one distinct difference: they take data provided by a real-time market data feeds and then they carry out instructions programmers specify the program should take based on certain conditions, parameters and variables. These rules are known as algorithms. Here is a simple example of a trading algorithm: an automated trading program should transmit a buy order to a brokerage’s trading platform if the market price of a security increases by 0.1% within a 30 second time span, the trading volume exceeds some specified number (maybe a number defined by a rolling average of the trading volume over the last week), and the time of day is between 9:00 a.m. and 3:00 p.m., in the exchange’s time zone.

Such rule-based actions are implemented well by a computer and they must be communicated to the computer in the form of a programming language. At its core, programming consists of nothing more than conditional logic: looping and branching form the basis of all programming. Looping is the act of doing something until a certain event takes place, and branching is the act of making one of two choices.

Trading programs monitor data feeds and they constantly “loop”: they comparing changing data with fixed data entered into the program in the form of parameters. For example, if the trading program has bought a security, and the trading rules specify that the program should sell the security if the profit captured exceeds 1%, the program will constantly calculate the profit captured until either the specified value has been reached (then the program will sell the security) or until some other rule specified that the program close the position.

Branching, is the process of making a decision based on two choices, a.k.a. bimodal. In formal logic this is manifest in the “if, then” construct. For example, if the time is between the hours of 9:00 a.m. and 3:00 p.m., then buying is permitted. Branching forms the basis of establishing constraints that must be satisfied prior to the program taking some form of action. For example, if the program is currently holding a number of securities that exposes the firm to excessive risk, the code may specify that the program not buy subsequent orders even though an algorithm in question would produce a buy order based on the market data feed and other conditions.

“Market makers” had traditionally been men and women standing at posts designated by the exchange as the location at which trading for specified stocks would take place. Market makers profit in a few ways, but one that is of interest here is how they capture the difference between securities’ bid and ask prices when trades take place. For example, if the bid/ask for a certain stock is 99/100, the market maker can buy the stock at 99 dollars and wait patiently until someone desperate wants to buy the stock – and they will cross the bid/ask spread in order to do so and buy the stock at the best available price, which is 100 dollars, in this example. Desperation trades take place when a buyer or seller will pay the best price offered by the counterparty. There is a distinction between active and passive buying. In active buying, one pays whatever happens to be the best offer on the opposing side, which is slightly more than the price he’d like to pay. The market maker would sell the stock to the first person that lifted his or her order. The market maker would have made 1 dollar for each unit of the security in question: s/he bought at 99 dollars, and sold at 100 dollars.

Automated market making is the process of using code and computers to make markets, rather than humans. Computers can accurately keep track of and process almost infinitely more data than humans can and they can do it at unimaginable speeds. The advent of the Internet and the attendant investor freedom to trade a broad range of securities anywhere in the world sowed the seed for the automation of trading. With automated trading a “market maker” can make markets in not only one security but dozens or hundreds of securities or more, if they have the resources and the ingenuity to create processes that make it work.

Algorithmic trading is made up of much more than just automated market making. There are oceans of relationships amongst securities and reams of data that traders analyze in an effort to deduce predictable sequences of events, inefficiencies or arbitrages that they can profitably trade upon - and with increasing frequency their trading is automated through the use of code, computers and algorithms.

Sunday, August 2, 2009

Quantum Support - Business Proposal




[Recipient Name]
[Company Name]
[Street Address]
[City, ST ZIP]

Dear [Recipient Name]:

Developing your practice can be greatly facilitated through the implementation of technology. You can be only in one place, at one time. Modern technology allows for the automation of many things and business development is one of them. People are looking for the legal services you provide and with increasing frequency they search the Internet in that pursuit. Placing a well-developed web site on the Internet allows for people to find you and to learn more about you while you are busy doing something else: web sites can and should be designed in a careful and persuasive manner to capitalize on a technology known as the Internet to obtain clients who are proactive in their pursuit of services you provide. The best part is that all of this takes place at the same time that you are practicing law. This is real multitasking: this is automation in its most literal sense.

Having a web site allows prospective clients to inform themselves of your practice, areas of expertise, background, education, achievements and more while you are litigating, filing motions & briefs, taking depositions, meeting with clients, networking, vacationing, and spending quality time with family and friends.

My father is a surgeon and I’ve built him several web sites. Many patients have told us that while looking through their insurers’ booklets, they decided to see my father for treatment rather than see other available and approved providers because they found pertinent information, documentation and images on his web sites. They said that this gave them a sense of familiarity that moved them to make an appointment with him, rather than someone else. They have also had an increase in patients through general web searches using terms totally unassociated with my father’s name or the name of his practices. Prior to their search, they had no awareness of his existence. That is automated business development. Please see http://www.drcastanon.com & http://www.castanon.me.

I singlehandedly have all of the skills that are required to build, maintain and administer web sites and their associated domains and can therefore vastly undercut prices other firms charge. Further, I have experience with search engine optimization and build sites following the principles of best practice, as advanced by Google. If sites are not built in a way that is search engine friendly, the site will never fare well in search engine rankings, to the detriment of the web site’s owner. I have a hard science degree and programming experience. Large design firms have a very limited ability to program, manipulate code, and a limited familiarity with the networking backbone of the Internet to make their sites search engine friendly, and they make a practice of not telling clients or prospective clients about their limitations. These firms know only design, not functionality.

I can build web sites for $XXX or less that both look good and accomplish their intended objective of being an effective point of contact for you while you are busy doing what’s important.


Sincerely,


Ethan Castanon