Wednesday, August 5, 2009

外汇学习

最近开始对炒外汇感兴趣, 先来说说为什么要炒外汇, 也就是炒外汇的好处吧. (一开始就说风险不把别人吓跑才怪) 以下都是从网上收集来的:

1. 交易成本低,无需佣金
外汇投资者无需通过代理机构来进行交易,因此不会被收取交易佣金。外汇交易商的利润仅从报价点差中来。如 EUR/USD 1.4225/1.4227,其中仅有的 2 个点的点差就是交易者的成本。股票交易通常会收取 $7 至 $20 不等的交易佣金(也有根据交易量大小计算费用),买进卖出一个来回,佣金将被收取两次。相对而言,外汇的交易成本要小得多。

2. 无论熊市牛市, 获利机会均等
在股市中,投资者如果想卖空(Short)利用熊市来获利,将面对诸多限制。如较高的保证金要求 (通常是卖空仓位市值的 150% 左右)、提高报价规则(uptick rule)以及借贷成本等。而外汇的做空机制非常灵活,没有任何限制,外汇交易者能自由地借助市场的涨势和跌势来投资获利。

3. 24小时全球交易
外汇市场是一个 24 小时永不停滞的全球市场,交易者可以根据自己的生活习惯安排交易时间。这也是为什么众多上班族选择炒汇的原因之一。同时,越来越多的人开始利用股市休市的时间交易外汇,把其当作一项分散投资风险的有效渠道。

4. 高至200:1的杠杆(据个人了解外汇杠杆可以高达400:1甚至500:1)
外汇交易中提供的杠杆比率通常是股票交易的 100 倍。比如,在股市中投资者能用 $1,000 来买价值 $2,000 的股票,而通过高达 200:1 的杠杆,外汇交易者可以用同样的 $1,000 来获得 $200,000 的购买力。显然,外汇交易以小博大的效力,是远胜于股票的。

当然,我们必须认识到,杠杆比率是一把双刃剑,它能使投资者迅速获利,同时也很容易增加风险。

5. 瞬间交割无限制
外汇市场是短线投资者的乐园,因为交易者能在一日内自由进出场,瞬间即可成交,随时兑现盈利。而股票交易者若想进行短线交易(Day Trading),将面对诸多限制,如交易者必须满足 $25,000 的最低保证金要求等。

6. 8000支股票 VS 7种主要货币
纽约证交所和那斯达克两所股市中有 8000 支以上的股票,面对繁多的市场杂讯,选股成为一件令投资者头痛的事。而在外汇市场中,7 种主要货币集中了 85% 的交易量,这使交易者能更快选择投资对象,节约时间和资金。

refactoring and performance

Many programmers always put performance at the first place in development. However, in my opinion, performance should be the last and least thing we need to worry about. Let's have a look at what Martin Fowler says in his book - Refactoring.

"To make the software easier to understand, you often make changes that will cause the program to run more slowly...but it also makes the software more amenable to performance tuning. The secret to fast software...is to write tunable software first and then to tune it for sufficient speed."

"Changes that improve performance usually make the program harder to work with"

"Build your programm in a well-factored manner without paying attention to performance until you begin a performance optimization stage, usually fairly late in development."

"A well-factored program ... gives you time to spend on performance tunning... Because the code is clearer, you have better understanding of your options and of what kind of tuning will work."

I always believe the first task for developer is to make the software easy to maintain, extend, modify. It also means we should focus more on architecture, structure, design, and coding style.

Unfortunately most of performance-first developers haven't realized that their performance achieved coding creates buggy, hard to understand and maintain system and finally achieves nothing but lost.

Why do we not just use assembly language for programming? We can get better performance than using C++, Java, PHP.

Why do we prefer OOP instead of coding in native language way? Native PHP language code runs faster than OOP code with those classes, objects.

Why do we break code into smaller pieces and functions? Putting everything in one function can save a lot of time than calling other functions and then return to the caller.

Why do we use template engine? Why not just embed PHP into HTML? It is faster.

Why do we use framework? It absolutely runs slower than a index.php.

Why do we use java? Every performance oriented programmer is crying Java is slow.