Added projects MtApi4 and MtApi5

This commit is contained in:
Vyacheslav Demidyuk
2014-10-31 09:05:52 +02:00
parent 869d3a117b
commit 8746e96416
178 changed files with 26390 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public enum ChartPeriod
{
ZERO = 0,
PERIOD_M1 = 1,
PERIOD_M5 = 5,
PERIOD_M15 = 15,
PERIOD_M30 = 30,
PERIOD_H1 = 60,
PERIOD_H4 = 240,
PERIOD_D1 = 1440,
PERIOD_W1 = 10080,
PERIOD_MN1 = 43200
}
}
+35
View File
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
static class ExtensionMethods
{
#region Event Methods
public static void FireEvent(this EventHandler eventHandler, object sender)
{
if (eventHandler != null)
{
eventHandler(sender, EventArgs.Empty);
}
}
public static void FireEvent<T>(this EventHandler<T> eventHandler, object sender, T e)
where T : EventArgs
{
if (eventHandler != null)
{
eventHandler(sender, e);
}
}
#endregion
public static MtQuote Parse(this MTApiService.MtQuote quote)
{
return (quote != null) ? new MtQuote(quote.Instrument, quote.Bid, quote.Ask) : null;
}
}
}
+39
View File
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public enum MarketInfoModeType
{
MODE_LOW = 1,
MODE_HIGH = 2,
MODE_TIME = 5,
MODE_BID = 9,
MODE_ASK = 10,
MODE_POINT = 11,
MODE_DIGITS = 12,
MODE_SPREAD = 13,
MODE_STOPLEVEL = 14,
MODE_LOTSIZE = 15,
MODE_TICKVALUE = 16,
MODE_TICKSIZE = 17,
MODE_SWAPLONG = 18,
MODE_SWAPSHORT = 19,
MODE_STARTING = 20,
MODE_EXPIRATION = 21,
MODE_TRADEALLOWED = 22,
MODE_MINLOT = 23,
MODE_LOTSTEP = 24,
MODE_MAXLOT = 25,
MODE_SWAPTYPE = 26,
MODE_PROFITCALCMODE = 27,
MODE_MARGINCALCMODE = 28,
MODE_MARGININIT = 29,
MODE_MARGINMAINTENANCE = 30,
MODE_MARGINHEDGED = 31,
MODE_MARGINREQUIRED = 32,
MODE_FREEZELEVEL = 33
}
}
+89
View File
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7A76C388-A8FB-4949-8170-24D4742E934E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MtApi</RootNamespace>
<AssemblyName>MtApi</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ChartPeriod.cs" />
<Compile Include="ExtensionMethods.cs" />
<Compile Include="MtConnectionEventArgs.cs" />
<Compile Include="MtConnectionState.cs" />
<Compile Include="MtCommandType.cs" />
<Compile Include="MtQuote.cs" />
<Compile Include="MtQuoteEventArgs.cs" />
<Compile Include="PriceConstantsType.cs" />
<Compile Include="MarketInfoModeType.cs" />
<Compile Include="MtApiClient.cs" />
<Compile Include="MtApiColorConverter.cs" />
<Compile Include="OrderSelectMode.cs" />
<Compile Include="OrderSelectSource.cs" />
<Compile Include="SeriesIdentifier.cs" />
<Compile Include="TradeOperation.cs" />
<Compile Include="MtApiTimeConverter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
<Project>{DE76D5C7-B99C-4467-8408-78173BDD84E0}</Project>
<Name>MTApiService</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy $(TargetPath) $(SolutionDir)Release\</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+1301
View File
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace MtApi
{
class MtApiColorConverter
{
public static Color ConvertFromMtColor(int color)
{
return Color.FromArgb(color);
}
public static int ConvertToMtColor(Color color)
{
return color == Color.Empty ? 0xffffff : (color.ToArgb() & 0xffffff);
}
}
}
+27
View File
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
class MtApiTimeConverter
{
public static DateTime ConvertFromMtTime(int time)
{
DateTime tmpTime = new DateTime(1970, 1, 1);
return new DateTime(tmpTime.Ticks + (time * 0x989680L));
}
public static int ConvertToMtTime(DateTime time)
{
int result = 0;
if (time != DateTime.MinValue)
{
DateTime tmpTime = new DateTime(1970, 1, 1);
result = (int)((time.Ticks - tmpTime.Ticks) / 0x989680L);
}
return result;
}
}
}
+186
View File
@@ -0,0 +1,186 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
enum MtCommandType
{
//NoCommand = 0
//trade operations
OrderSend = 1,
OrderClose = 2,
OrderCloseBy = 3,
OrderClosePrice = 4,
OrderClosePriceByTicket = 1004,
OrderCloseTime = 5,
OrderComment = 6,
OrderCommission = 7,
OrderDelete = 8,
OrderExpiration = 9,
OrderLots = 10,
OrderMagicNumber = 11,
OrderModify = 12,
OrderOpenPrice = 13,
OrderOpenPriceByTicket = 1013,
OrderOpenTime = 14,
OrderPrint = 15,
OrderProfit = 16,
OrderSelect = 17,
OrdersHistoryTotal = 18,
OrderStopLoss = 19,
OrdersTotal = 20,
OrderSwap = 21,
OrderSymbol = 22,
OrderTakeProfit = 23,
OrderTicket = 24,
OrderType = 25,
//Check Status
GetLastError = 26,
IsConnected = 27,
IsDemo = 28,
IsDllsAllowed = 29,
IsExpertEnabled = 30,
IsLibrariesAllowed = 31,
IsOptimization = 32,
IsStopped = 33,
IsTesting = 34,
IsTradeAllowed = 35,
IsTradeContextBusy = 36,
IsVisualMode = 37,
UninitializeReason = 38,
ErrorDescription = 39,
//Account Information
AccountBalance = 40,
AccountCredit = 41,
AccountCompany = 42,
AccountCurrency = 43,
AccountEquity = 44,
AccountFreeMargin = 45,
AccountFreeMarginCheck = 46,
AccountFreeMarginMode = 47,
AccountLeverage = 48,
AccountMargin = 49,
AccountName = 50,
AccountNumber = 51,
AccountProfit = 52,
AccountServer = 53,
AccountStopoutLevel = 54,
AccountStopoutMode = 55,
//Common Commands
Alert = 56,
Comment = 57,
GetTickCount = 58,
MarketInfo = 59,
MessageBox = 60,
MessageBoxA = 61,
PlaySound = 62,
Print = 63,
SendFTP = 64,
SendFTPA = 65,
SendMail = 66,
Sleep = 67,
//Client Terminal
TerminalCompany = 68,
TerminalName = 69,
TerminalPath = 70,
//Date and Time
Day = 71,
DayOfWeek = 72,
DayOfYear = 73,
Hour = 74,
Minute = 75,
Month = 76,
Seconds = 77,
TimeCurrent = 78,
TimeDay = 79,
TimeDayOfWeek = 80,
TimeDayOfYear = 81,
TimeHour = 82,
TimeLocal = 83,
TimeMinute = 84,
TimeMonth = 85,
TimeSeconds = 86,
TimeYear = 87,
Year = 88,
//Global Variables
GlobalVariableCheck = 89,
GlobalVariableDel = 90,
GlobalVariableGet = 91,
GlobalVariableName = 92,
GlobalVariableSet = 93,
GlobalVariableSetOnCondition = 94,
GlobalVariablesDeleteAll = 95,
GlobalVariablesTotal = 96,
//Technical Indicators
iAC = 97,
iAD = 98,
iAlligator = 99,
iADX = 100,
iATR = 101,
iAO = 102,
iBearsPower = 103,
iBands = 104,
iBandsOnArray = 105,
iBullsPower = 106,
iCCI = 107,
iCCIOnArray = 108,
iCustom = 109,
iCustom_d = 10109,
iDeMarker = 110,
iEnvelopes = 111,
iEnvelopesOnArray = 112,
iForce = 113,
iFractals = 114,
iGator = 115,
iIchimoku = 116,
iBWMFI = 117,
iMomentum = 118,
iMomentumOnArray = 119,
iMFI = 120,
iMA = 121,
iMAOnArray = 122,
iOsMA = 123,
iMACD = 124,
iOBV = 125,
iSAR = 126,
iRSI = 127,
iRSIOnArray = 128,
iRVI = 129,
iStdDev = 130,
iStdDevOnArray = 131,
iStochastic = 132,
iWPR = 133,
//Timeseries access
iBars = 134,
iBarShift = 135,
iClose = 136,
iHigh = 137,
iHighest = 138,
iLow = 139,
iLowest = 140,
iOpen = 141,
iTime = 142,
iVolume = 143,
iCloseArray = 144,
iHighArray = 145,
iLowArray = 146,
iOpenArray = 147,
iVolumeArray = 148,
iTimeArray = 149,
//
RefreshRates = 150
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public class MtConnectionEventArgs: EventArgs
{
public MtConnectionState Status { get; private set; }
public String ConnectionMessage { get; private set; }
public MtConnectionEventArgs(MtConnectionState status, string message)
{
Status = status;
ConnectionMessage = message;
}
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public enum MtConnectionState
{
Connecting,
Connected,
Disconnected,
Failed
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public class MtQuote
{
public string Instrument { get; private set; }
public double Bid { get; private set; }
public double Ask { get; private set; }
public MtQuote(string instrument, double bid, double ask)
{
Instrument = instrument;
Bid = bid;
Ask = ask;
}
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public class MtQuoteEventArgs : EventArgs
{
public MtQuote Quote { get; private set; }
public MtQuoteEventArgs(MtQuote quote)
{
Quote = quote;
}
}
}
+13
View File
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public enum OrderSelectMode
{
SELECT_BY_POS = 0,
SELECT_BY_TICKET = 1
}
}
+13
View File
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public enum OrderSelectSource
{
MODE_TRADES = 0,
MODE_HISTORY = 1
}
}
+18
View File
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public enum PriceConstantsType
{
PRICE_CLOSE = 0,
PRICE_OPEN = 1,
PRICE_HIGH = 2,
PRICE_LOW = 3,
PRICE_MEDIAN = 4,
PRICE_TYPICAL = 5,
PRICE_WEIGHTED = 6
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MtApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("DW")]
[assembly: AssemblyProduct("MtApi")]
[assembly: AssemblyCopyright("Copyright © DW 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("650e3c56-dbce-45d4-a844-94bbe9f9a3bf")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.15.0")]
[assembly: AssemblyFileVersion("1.0.15.0")]
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public enum SeriesIdentifier
{
MODE_OPEN = 0,
MODE_LOW = 1,
MODE_HIGH = 2,
MODE_CLOSE = 3,
MODE_VOLUME = 4,
MODE_TIME = 5
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{
public enum TradeOperation
{
OP_BUY = 0,
OP_SELL = 1,
OP_BUYLIMIT = 2,
OP_SELLLIMIT = 3,
OP_BUYSTOP = 4,
OP_SELLSTOP = 5
}
}