Use Excel to create the indexed performance graph
1. Generate the original data like the below:
Date Amount Index
20150107 100559.08 3373.95
20150108 102548.36 3293.46
20150109 102860.37 3285.41
20150112 103072.33 3229.32
2. Use format to convert the data to indexed data
The formula should be like =C2/$C$2*100 wrap with $ to make it fix
Date Amount Index
1/7/2015 100 1/0/1900
1/8/2015 101.9782202 97.61436891
1/9/2015 102.2884955 97.37577617
1/12/2015 102.499277 95.71333304
3. Use Data -> Text to Columns to convert the text yyyymmdd to date YMD
4. Select all transformed data (include the header), and insert line (first one is good if there are a lot of data, all may select grapth with markders)
References:
http://academics.smcvt.edu/cbauer-ramazani/AEP/BU113/finance/create_index_graph.htm
http://www.extendoffice.com/documents/excel/2777-excel-convert-yyyymmdd-to-date.html
Friday, November 20, 2015
Thursday, November 19, 2015
VC++ scheduler/timer and other sources
http://download.csdn.net/detail/Jeffrey_Ming/1195343
http://blog.csdn.net/clever101/article/details/47756047
http://download.csdn.net/detail/hero20025627hxh/1663637
http://download.csdn.net/detail/zhouzhenyang1990/3075088
http://download.csdn.net/detail/s672038161/3206737
http://download.csdn.net/detail/houhuijuan/3446698
http://download.csdn.net/detail/notsunny/8740609
http://download.csdn.net/detail/sunanguo/880743
http://download.csdn.net/detail/fish_1001/8604645
#include <ctime>
#include <iostream>
#include <windows.h>
using namespace std;
int main() {
while(true){
time_t t = time(0); // get time now
struct tm * now = localtime( & t );
if(now->tm_min>39){//begin
cout << "current min " << now->tm_min << ", sec = " << now->tm_sec << endl;
}
if(now->tm_min>40){//end
cout << "will break, current min " << now->tm_min << ", sec = " << now->tm_sec << endl;
break;
}
Sleep(3000);
}
}
http://blog.csdn.net/clever101/article/details/47756047
http://download.csdn.net/detail/hero20025627hxh/1663637
http://download.csdn.net/detail/zhouzhenyang1990/3075088
http://download.csdn.net/detail/s672038161/3206737
http://download.csdn.net/detail/houhuijuan/3446698
http://download.csdn.net/detail/notsunny/8740609
http://download.csdn.net/detail/sunanguo/880743
http://download.csdn.net/detail/fish_1001/8604645
#include <ctime>
#include <iostream>
#include <windows.h>
using namespace std;
int main() {
while(true){
time_t t = time(0); // get time now
struct tm * now = localtime( & t );
if(now->tm_min>39){//begin
cout << "current min " << now->tm_min << ", sec = " << now->tm_sec << endl;
}
if(now->tm_min>40){//end
cout << "will break, current min " << now->tm_min << ", sec = " << now->tm_sec << endl;
break;
}
Sleep(3000);
}
}
Sunday, November 1, 2015
be right or be kind
When given the choice between being right or being kind, choose kind. - Dr Wayne W. Dyer
Thursday, October 22, 2015
use ffmpeg to transform avi to mp3 on mac
465 ./ffmpeg -i /Users/peterpeng/video/六人行/Season1/\[六人行\].Friends.01x01.The.One.Where.Monica.Gets.A.New.Roommate.DVDRip.AC3.3.2ch.JOG.avi -ss 00:00:55.000 -b:a 128k S1E01.mp3
469 ./ffmpeg -i /Users/peterpeng/video/六人行/Season1/\[六人行\].Friends.01x02.The.One.With.The.Sonogram.At.The.End.DVDRip.AC3.3.2ch.JOG.avi -b:a 128k S1E02.mp3
batch transform for the avi in a directory:
for i in *.avi;
do name=`echo $i | cut -d'.' -f3`;
echo "transfroming ...$name";
/Users/peterpeng/Downloads/ffmpeg -i $i -b:a 128k $name.mp3
done
Tuesday, October 20, 2015
Auspix todo
1. genEnter by C++
2. Refractor and backtest
2.1 real1
2.2 real2
2.3 long term
2.4 czsc
2.5 formula
2. Refractor and backtest
2.1 real1
2.2 real2
2.3 long term
2.4 czsc
2.5 formula
Monday, October 19, 2015
Thinking in C++ note (chapter 1 - 3)
Making and using objects:
1. Declaring a variable without defining it means using the extern keyword before a description of the variable, like this:
extern int a;
The keyword is extern. It can mean the definition is external to the file, or that the definition occurs later in the file.
2. A header file is a file containing the external declarations for a library; it conventionally has a file name extension of ‘h’, such as headerfile.h.
#include "local.h" is to search for the file relative to the current directory. If the file is not found, then the include directive
is reprocessed as if it had angle brackets instead of quotes.
3. First program
#include <iostream> // Stream declarations
using namespace std;
int main() {
cout << "Hello, World! I am "
<< 8 << " Today!" << endl;
} ///:~
C:\MinGW\sources>g++ Hello.cpp -o Hello.exe
4. system
system("ping -a www.google.com");
To use the system( ) function, you give it a character array that you would normally type at the operating system command prompt..
5. Reading and writing files
//: C02:Scopy.cpp
// Copy one file to another, a line at a time
#include <string>
#include <fstream>
using namespace std;
int main() {
ifstream in("Scopy.cpp"); // Open for reading
ofstream out("Scopy2.cpp"); // Open for writing
string s;
while(getline(in, s)) // Discards newline char
out << s << "\n"; // ... must add it back
} ///:~
The C in C++
1. pointer
int* ip; // ip points to an int variable
int a = 47;
int* ipa = &a; //Now both a and ipa have been initialized, and ipa holds the address of a.
*ipa = 100; //Now a contains the value 100 instead of 47.
2.
Pointers work roughly the same in C and in C++, but C++ adds an additional way to pass an address into a function. This is pass-by-reference
and it exists in several other programming languages so it was not a C++ invention.
Once you assign to a void* you lose any information about what type it is. This means that before you can use the pointer, you must cast it to the correct type
int main() {
int i = 99;
void* vp = &i;
// Can't dereference a void pointer:
// *vp = 3; // Compile-time error
// Must cast back to int before dereferencing:
*((int*)vp) = 3;
}
3.
Global variables are defined outside all function bodies and are available to all parts of the program (even code in other files).
extern int globe;
There are restrictions to the use of register variables. You cannot take or compute the address of a register variable.
A register variable can be declared only within a block
4.
If you want a value to be extant throughout the life of a program, you can define a function’s local variable to be static and
give it an initial value. The initialization is performed only the first time the function is called, and the data retains its
value between function calls.
You may wonder why a global variable isn’t used instead. The beauty of a static variable is that it is unavailable outside the scope
of the function, so it can’t be inadvertently changed. This localizes errors.
#include <iostream>
using namespace std;
void func() {
static int i = 0;
cout << "i = " << ++i << endl;
}
int main() {
for(int x = 0; x < 10; x++)
func();
} ///:~
// File scope means only available in this file:
static int fs;
int main() {
fs = 1;
} ///:~
5. const and volatile
The modifier const tells the compiler that a name represents a constant. In C++, a const must always have an initialization value
const int x = 10;
Whereas the qualifier const tells the compiler “This never changes” (which allows the compiler to perform extra optimizations),
the qualifier volatile tells the compiler “You never know when this will change,” and prevents the compiler from performing any
optimizations based on the stability of that variable.
6.
static_cast: is used for all conversions that are well-defined.
const_cast: If you want to convert from a const to a nonconst or from a volatile to a nonvolatile, you use const_cast.
reinterpret_cast: To cast to a completely different meaning.
typedef unsigned long ulong;
To read: Data Abstraction
Wednesday, October 7, 2015
English learning
1. Special VOA
Listen two package Special VOA 10 times every day, after checking the subtitles,
listen 10 times again.
2. Same steps for normal VOA
3. Same for talkshow like Saturday Night
4. Read www.economist.com or www.nytimes.com articles every day
Subscribe to:
Posts (Atom)