Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
anderj017 committed Mar 1, 2015
0 parents commit 13864ff
Show file tree
Hide file tree
Showing 42 changed files with 1,293 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/
obj/
101 changes: 101 additions & 0 deletions Bet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
using System;
using Newtonsoft.Json;

namespace PinnacleWrapper
{
public class Bet
{
[JsonProperty(PropertyName = "betId")]
public int BetId;

[JsonProperty(PropertyName = "wagerNumber")]
public int WagerNumber;

[JsonProperty(PropertyName = "placedAt")]
public DateTime PlacedAt;

[JsonProperty(PropertyName = "win")]
public decimal Win;

[JsonProperty(PropertyName = "risk")]
public decimal Risk;

[JsonProperty(PropertyName = "winLoss")]
public decimal WinLoss;

[JsonProperty(PropertyName = "betStatus")]
public BetStatus BetStatus;

[JsonProperty(PropertyName = "betType")]
public BetType BetType;

[JsonProperty(PropertyName = "sportId")]
public int SportId;

[JsonProperty(PropertyName = "leagueId")]
public int LeagueId;

[JsonProperty(PropertyName = "eventId")]
public int EventId;

[JsonProperty(PropertyName = "handicap")]
public decimal? Handicap;

[JsonProperty(PropertyName = "price")]
public decimal Price;

[JsonProperty(PropertyName = "teamName")]
public string TeamName;

[JsonProperty(PropertyName = "side")]
public SideType? Side;

[JsonProperty(PropertyName = "oddsFormat")]
public OddsFormat OddsFormat;

[JsonProperty(PropertyName = "customerCommission")]
public decimal? ClientCommission;

[JsonProperty(PropertyName = "pitcher1")]
public string Pitcher1;

[JsonProperty(PropertyName = "pitcher2")]
public string Pitcher2;

[JsonProperty(PropertyName = "pitcher1MustStart")]
public bool? Pitcher1MustStart;

[JsonProperty(PropertyName = "pitcher2MustStart")]
public bool? Pitcher2MustStart;

[JsonProperty(PropertyName = "team1")]
public string Team1;

[JsonProperty(PropertyName = "team2")]
public string Team2;

[JsonProperty(PropertyName = "periodNumber")]
public string PeriodNumber;

[JsonProperty(PropertyName = "team1Score")]
public decimal? Team1Score;

[JsonProperty(PropertyName = "team2Score")]
public decimal? Team2Score;

[JsonProperty(PropertyName = "ftTeam1Score")]
public decimal FullTimeTeam1Score;

[JsonProperty(PropertyName = "ftTeam2Score")]
public decimal FullTimeTeam2Score;

[JsonProperty(PropertyName = "pTeam1Score")]
public decimal? PartTimeTeam1Score;

[JsonProperty(PropertyName = "pTeam2Score")]
public decimal? PartTimeTeam2Score;

[JsonProperty(PropertyName = "isLive")]
public bool IsLive;
}
}
15 changes: 15 additions & 0 deletions BetAmount.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Xml.Serialization;

namespace PinnacleWrapper
{
[Serializable]
public class BetAmount
{
[XmlElement("spread")]
public double Spread { get; set; }

[XmlElement("moneyLine")]
public double MoneyLine { get; set; }
}
}
8 changes: 8 additions & 0 deletions BetListType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace PinnacleWrapper
{
public enum BetListType
{
Settled,
Running
}
}
17 changes: 17 additions & 0 deletions BetStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace PinnacleWrapper
{
[JsonConverter(typeof(StringEnumConverter))]
public enum BetStatus
{
Accepted,
PendingAcceptance,
Rejected,
Refunded,
Cancelled,
Lose,
Won
}
}
14 changes: 14 additions & 0 deletions BetType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace PinnacleWrapper
{
[JsonConverter(typeof(StringEnumConverter))]
public enum BetType
{
Spread,
MoneyLine,
TotalPoints,
TeamTotalPoints
}
}
19 changes: 19 additions & 0 deletions ClientBalance.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Newtonsoft.Json;

namespace PinnacleWrapper
{
public class ClientBalance
{
[JsonProperty(PropertyName = "availableBalance")]
public decimal AvailableBalance;

[JsonProperty(PropertyName = "outstandingTransactions")]
public decimal OutstandingTransactions;

[JsonProperty(PropertyName = "givenCredit")]
public decimal GivenCredit;

[JsonProperty(PropertyName = "currency")]
public string Currency;
}
}
15 changes: 15 additions & 0 deletions CurrenciesResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace PinnacleWrapper
{
[Serializable]
[XmlRoot("rsp")]
public class CurrenciesResponse : XmlResponse
{
[XmlArray("currencies")]
[XmlArrayItem("currency")]
public List<Currency> Currencies { get; set; }
}
}
16 changes: 16 additions & 0 deletions Currency.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Xml.Serialization;

namespace PinnacleWrapper
{
[Serializable]
[XmlRoot("currency")]
public class Currency
{
[XmlAttribute("code")]
public string Code { get; set; }

[XmlText]
public string Name { get; set; }
}
}
73 changes: 73 additions & 0 deletions Event.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace PinnacleWrapper
{
[Serializable]
[XmlRoot("event")]
public class Event
{
[XmlElement("startDateTime")]
public DateTime StartDateTime { get; set; }

[XmlElement("id")]
public long Id { get; set; }

[XmlElement("IsLive")]
public string IsLiveString { get; set; }

[XmlIgnore]
public bool IsLive
{
get
{
return IsLiveString.Equals("Yes", StringComparison.OrdinalIgnoreCase);
}

set
{
IsLiveString = (value ? "Yes" : "No");
}
}

[XmlElement("status")]
public string StatusString { get; set; }

[XmlIgnore]
public Status Status
{
get
{
if (!string.IsNullOrWhiteSpace(StatusString))
{
switch (StatusString.ToLower())
{
case "o":
return Status.Open;
case "i":
return Status.LowerMaximum;
case "h":
return Status.Unavailable;
case "x":
return Status.Cancelled;
default:
throw new Exception("Unrecognized status: " + StatusString);
}
}

throw new Exception("No status string");
}
}

[XmlElement("homeTeam")]
public Team HomeTeam { get; set; }

[XmlElement("awayTeam")]
public Team AwayTeam { get; set; }

[XmlArray("periods")]
[XmlArrayItem("period")]
public List<Period> Periods { get; set; }
}
}
18 changes: 18 additions & 0 deletions Feed.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace PinnacleWrapper
{
[Serializable]
[XmlRoot("fd")]
public class Feed
{
[XmlElement("fdTime")]
public long Timestamp { get; set; }

[XmlArray("sports")]
[XmlArrayItem("sport")]
public List<FeedSport> Sports { get; set; }
}
}
18 changes: 18 additions & 0 deletions FeedLeague.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace PinnacleWrapper
{
[Serializable]
[XmlRoot("league")]
public class FeedLeague
{
[XmlElement("id")]
public int Id { get; set; }

[XmlArray("events")]
[XmlArrayItem("event")]
public List<Event> Events { get; set; }
}
}
13 changes: 13 additions & 0 deletions FeedResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Xml.Serialization;

namespace PinnacleWrapper
{
[Serializable]
[XmlRoot("rsp")]
public class FeedResponse : XmlResponse
{
[XmlElement("fd")]
public Feed Feed { get; set; }
}
}
18 changes: 18 additions & 0 deletions FeedSport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace PinnacleWrapper
{
[Serializable]
[XmlRoot("sport")]
public class FeedSport
{
[XmlElement("id")]
public int Id { get; set; }

[XmlArray("leagues")]
[XmlArrayItem("league")]
public List<FeedLeague> Leagues { get; set; }
}
}
11 changes: 11 additions & 0 deletions GetBetsResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;
using Newtonsoft.Json;

namespace PinnacleWrapper
{
public class GetBetsResponse
{
[JsonProperty(PropertyName = "bets")]
public List<Bet> Bets;
}
}
16 changes: 16 additions & 0 deletions GetInRunningResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Newtonsoft.Json;

namespace PinnacleWrapper
{
public class GetInRunningResponse
{
[JsonProperty(PropertyName = "elapsed")]
public int Elapsed;

[JsonProperty(PropertyName = "state")]
public InRunningState State;

[JsonProperty(PropertyName = "id")]
public int Id;
}
}
Loading

0 comments on commit 13864ff

Please sign in to comment.